Currently, I am in the process of configuring mongodb, and our servers are managed through puppet.
While I have successfully set up most components as required, I still need to create a user within the mongo database.
I am familiar with how to accomplish this task using the mongo shell by executing javascript commands such as:
db.addUser("username", "password"[, readOnly])
However, what eludes me is finding a concrete example demonstrating how to execute this in javascript. My ultimate objective is to add a user from the command line, preferably through a shell script.
If someone could provide:
a) references to reliable examples illustrating the use of javascript with MongoDB, and
b) guidance on how to achieve this through the command line?