add a mongodb user as admin code example
Example 1: mongodb add user
use
db.createUser({
user: '',
pwd: passwordPrompt(),
roles: [{
role: 'readWrite',
db: ''
}]
})
Example 2: mongodb add admin user
use admin
db.createUser({
user: "username",
pwd: "password",
roles: [ "root" ]
})