title: Minimum permission for using mongodump (to dump a specific db)
body: <p>We can't seem to find any conclusive document on what permissions (user roles) are required to run <code>mongodump</code> on a specific db.</p>
  
  <p>Say I have a db named <code>x</code> and a user <code>y</code> on it with following roles <code>roles: [ "readWrite", "dbAdmin" ]</code>, as well as 2 users <code>a</code> and <code>b</code> on <code>admin</code> collection with <code>roles: [ "userAdminAnyDatabase" ]</code> and <code>roles: [ "dbAdminAnyDatabase" ]</code>, it seems none of them has the right permission to run <code>mongodump</code>:</p>
  
  <pre><code>mongodump --db x --username y --password --authenticationDatabase x
  
  Tue Dec 10 17:04:23.901     x.system.users to dump/x/system.users.bson
  assertion: 11010 count fails:{ ok: 0.0, errmsg: "unauthorized" }
  
  mongodump --db x --username a --password --authenticationDatabase admin
  
  Tue Dec 10 17:06:19.674 DATABASE: x  to     dump/x
  assertion: 13106 nextSafe(): { $err: "not authorized for query on x.system.indexes", code: 16550 }
  
  mongodump --db x --username b --password --authenticationDatabase admin
  
  Tue Dec 10 17:08:20.678 DATABASE: x  to     dump/x
  assertion: 13106 nextSafe(): { $err: "not authorized for query on x.system.namespaces", code: 16550 }
  </code></pre>
  
  <p>We must be missing something obvious, but <strong>what does mongodump look for when dumping a database and what permission does it need?</strong></p>
  
  <p>PS: as a bonus, we would like to figure out what user roles are needed to dump a specific collection, as well as all db(s).</p>