title: MongoDB: Understand createUser and db admin
body: <p>My MongoDB is hosted on compose.io and is called ScroungeBA.
  I try to create a user with some built-in roles which by the documentary only work in the admin database:  </p>
  
  <blockquote>
    <p>MongoDB provides all other built-in roles only on the admin database  </p>
  </blockquote>
  
  <p>So my question: What is that admin db about? Is it the standard db which always exists?</p>
  
  <p>Furthermore I have trouble with (using MongoDB shell version: 3.0.5):</p>
  
  <pre><code>$ use admin
  switched to db admin
  $ db.auth("user", "secret")
  Error: 18 Authentication failed.
  </code></pre>
  
  <p>I guess my user does exist in the ScroungeBA db but not in the admin db? How can I create a user in the admin db since</p>
  
  <pre><code>db.createUser({user:"hello", pwd:"world", roles:[{role: "userAdmin", db: "admin"}]})
  </code></pre>
  
  <p>results in the error:</p>
  
  <pre><code>Error: couldn't add user: not authorized on admin to execute command { createUser: "hello", pwd: "xxx", roles: [ { role: "userAdmin", db: "admin" } ], digestPassword: false, writeConcern: { w: "majority", wtimeout: 30000.0 } }
  at Error (&lt;anonymous&gt;)
  at DB.createUser (src/mongo/shell/db.js:1101:11)
  at (shell):1:4 at src/mongo/shell/db.js:1101
  </code></pre>