title: What MongoDB user privileges do I need to add a user to a new/another mongo database?
body: <p>I have enabled authentication in the MongoDB config file after adding one admin user with the following privileges: <code>userAdmin</code> and <code>userAdminAnyDatabase</code>.</p>
  
  <p>Now I connect with this user to the db where this admin user is defined (otherwise I get <code>exception: login failed</code>).</p>
  
  <p>After I have successfully connected I want to add the a new user to a new database. For that I am trying:</p>
  
  <pre><code>use another
  db.addUser(...)
  </code></pre>
  
  <p>but I get an error:</p>
  
  <pre><code>Wed Dec 11 17:45:18.277 couldn't add user: not authorized for insert on app.system.users at src/mongo/shell/db.js:128
  </code></pre>
  
  <p>How can I create a new database and add a first user to it?</p>
  
  <hr>
  
  <p><strong>Detailed</strong> (all users have 1234 as password in this example)</p>
  
  <pre><code>$ mongo mono -u admin_all -p 1234
  MongoDB shell version: 2.4.6
  connecting to: mono
  &gt; db.system.users.find()
  { "_id" : ObjectId("52a9831de41eb640bb0f5f64"), "user" : "admin_all", "pwd" : "a6316ed4886c10663cce46bc216ea375", "roles" : [  "userAdmin",  "userAdminAnyDatabase" ] }
  { "_id" : ObjectId("52a98404ef1f9bc934b62e11"), "user" : "admin_one", "pwd" : "884f516cf308a4c6a75bbc5a0a00807b", "roles" : [  "userAdmin" ] }
  { "_id" : ObjectId("52a98415ef1f9bc934b62e12"), "user" : "admin_any", "pwd" : "1616611df9b47c58b607054d384cab99", "roles" : [  "userAdminAnyDatabase" ] }
  &gt; use another
  switched to db another
  &gt; db.addUser({ user: "user", pwd: "1234", roles: ["read"] })
  {
      "user" : "user",
      "pwd" : "461d4f349d8d4ec3d22a4c945010c330",
      "roles" : [
          "read"
      ],
      "_id" : ObjectId("52a985372fcdbfd033003a7e")
  }
  Thu Dec 12 10:43:19.091 couldn't add user: not authorized for insert on another.system.users at src/mongo/shell/db.js:128
  </code></pre>