title: How can I use a script to create users in mongodb?
body: <p>I'm in the process of setting up mongodb, and we use puppet to control the configuration of our servers.</p>
  
  <p>I've got most things setup how I need them, but I need to create the user inside the mongo database.</p>
  
  <p>I know how to do this using the mongo shell, and I know that I can do it using javascript / a .js using the command </p>
  
  <pre><code>db.addUser("username", "password"[, readOnly])
  </code></pre>
  
  <p>However, I have been unable to find a solid example of what is needed to do this in javascript. More to the point, I need to be able to add a user from the command line, using some sort of shell script.</p>
  
  <p>If someone could </p>
  
  <p>a) point me to some solid examples of using javascript with mongoDB and </p>
  
  <p>b) how can I do this from the command line?</p>