mongo = new Mongo("localhost");
db = mongo.getDB("admin");
db.addUser( { user: "dbadmin",
pwd: "test",
roles: [ "readWriteAnyDatabase",
"dbAdminAnyDatabase",
"clusterAdmin" ] } );
db.addUser( { user: "useradmin",
pwd: "test",
roles: [ "userAdminAnyDatabase" ] } )
save above in add_user.js file
mongo add_user.js
db.auth("mswregUser","xxxxx")
No comments:
Post a Comment