Tuesday, July 14, 2015

MongoDB Authentication - My Notes




for setting the authentication:
> use admin
> show collections
  system.indexes
  system.users
> db.createUser({ "user" : "panbhatt" , "pwd" : "*******" , "roles" : [ "readWrite" ]})
OR
db.addUser("panbhatt","internet")   // This is OLD
> db.system.users.find()
 // To Verify that the user has been registered.

now switch to another database
> use logs
> Add the user same as above conditions

use db.dropUser("nameofUser") // to drop an user.

http://blog.amussey.com/post/62809509642/mongodb-installing-and-configuring-authentication