use mydb db.createUser( { "user" : "accountAdmin01", "pwd": "cleartext password", "customData" : { employeeId: 12345 }, "roles" : [ { role: "clusterAdmin", db: "admin" }, { role: "readAnyDatabase", db: "admin" }, "readWrite" ] }, { w: "majority" , wtimeout: 5000 } ) # the clusterAdmin and readAnyDatabase roles on the admin database # the readWrite role on the mydb database db.createUser( { user: "accountUser", pwd: "password", roles: [ "readWrite", "dbAdmin" ] } ) # creates accountUser in the mydb database and gives the user the readWrite and dbAdmin roles.
|