Tech Hacks

Creating users in MongoDB


Creating users in MongoDB is as simple as running the following commands:

use db_name;
db.createUser({
user: "user_name",
pwd: "password",
roles: [ "readWrite", "dbAdmin" ]
})

Here: