mongod add admin user to database code example
Example 1: create admin user in mongodb
use admin
db.createUser(
{
user: "username",
pwd: "password",
roles: [ "root" ]
}
)
Example 2: mongodb add admin user
use admin
db.createUser({
user: "username",
pwd: "password",
roles: [ "root" ]
})