title: Run MongoDB 3.6 as a brew service with auth
body: <p><strong>MongoDB v3.6.4</strong>: After migrating from mongo 3.4 to 3.6</p>
  
  <p>From the shell I am able to startup the db and connect to it with authentication.</p>
  
  <pre><code>mongod --auth --port 27017 --dbpath /data/db
  </code></pre>
  
  <p>However when I start mongodb with brew the authentication does not work and it is not possible to authenticate manually either.</p>
  
  <pre><code>~   $ mongo
  MongoDB shell version v3.6.4
  connecting to: mongodb://127.0.0.1:27017
  MongoDB server version: 3.6.4
  &gt; use admin
  switched to db admin
  &gt; db.stats()
  {
      "ok" : 0,
      "errmsg" : "not authorized on admin to execute command { dbstats: 1.0, scale: undefined, $db: \"admin\" }",
      "code" : 13,
      "codeName" : "Unauthorized"
  }
  &gt; db.auth('superAdmin', 'password')
  Error: Authentication failed.
  0
  </code></pre>
  
  <p>How is it possible to run mongodb as a service with auth?</p>
  
  <p>It is possible to opt-out authentication by setting authorization to disabled in the /usr/local/etc/mongod.conf file however it would be nice to run the service with the required priviliages:</p>
  
  <pre><code>security:
    authorization: disabled
  </code></pre>
  
  <p><em>Done, checked:</em> </p>
  
  <blockquote>
    <ol>
    <li><a href="https://stackoverflow.com/questions/41664476/mongodb-on-osx-how-to-update-brew-service-to-start-with-auth">The answer suggested here does not seem to be correct either - it is not a valid command</a><code>brew services start mongodb --auth --port 27017 --dbpath /usr/local/var/mongodb</code></li>
    </ol>
  </blockquote>