title: How to give diagnostic actions listDatabases to a user in mongodb?
body: <p>I'm trying to connect from a java application to a mongodb database in openshift and I'm having some trouble with roles and actions allowed.</p>
  
  <p>I run the rch port-forward command like so:</p>
  
  <pre><code>rhc port-forward -a test
  </code></pre>
  
  <p>it all goes great and I'm able to connect to the database using:</p>
  
  <pre><code>mongo admin -u admin -p '*******' --host 127.0.0.1 --port 44506
  </code></pre>
  
  <p>and I can execute commands like:</p>
  
  <pre><code>&gt; use test
  &gt; show databases
  </code></pre>
  
  <p>But if i connect directly to my database using:</p>
  
  <pre><code>mongo test -u admin -p '*******' --host 127.0.0.1 --port 44506
  </code></pre>
  
  <p>I'm unable to run the show databases command</p>
  
  <pre><code>listDatabases failed:{ "ok" : 0, "errmsg" : "unauthorized" } at src/mongo/shell/mongo.js:47
  </code></pre>
  
  <p>How can i give action listDatabases to this user in this database?</p>
  
  <p>I found this page in the mongodb documentation <a href="http://docs.mongodb.org/manual/reference/privilege-actions/#security-user-actions" rel="nofollow">http://docs.mongodb.org/manual/reference/privilege-actions/#security-user-actions</a>
  Which talks about Diagnostic Actions but does not mention how to give such action to a user.</p>
  
  <p>Thanks for the help.</p>