mongodb roles users html.it code example
Example 1: mongodb readwrite to all dbs
use admin
db.createUser({
user: '<some username>',
pwd: passwordPrompt(), // or '<your password>'
roles: [ "userAdminAnyDatabase", "readWriteAnyDatabase" ]
})
Example 2: mongodb add admin user
use admin
db.createUser({
user: "username",
pwd: "password",
roles: [ "root" ]
})