title: MongoDB command line to show if a user exists (for puppet 'unless' clause)
body: <p>We are using MongoDB user based authentication, and I want to quickly run a command to check whether a user has already been created in the database, in order that puppet won't repeatedly attempt to create the user.</p>
  
  <p>Here is how we check if the replica set has initialised:</p>
  
  <pre><code>/usr/bin/mongo --host ${members[0]} --quiet --eval 'rs.status().ok' | grep -q 1
  </code></pre>
  
  <p>Is a similar trick possible with authentication? I've checked the documentation here <a href="http://www.mongodb.org/display/DOCS/dbshell+%28mongo%29+Reference">http://www.mongodb.org/display/DOCS/dbshell+%28mongo%29+Reference</a> and I can't see a way of doing it?</p>