I'm in the process of setting up mongodb, and we use puppet to control the configuration of our servers.
I've got most things setup how I need them, but I need to create the user inside the mongo database.
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
db.addUser("username", "password"[, readOnly])
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.
If someone could
a) point me to some solid examples of using javascript with mongoDB and
b) how can I do this from the command line?