Home | Mirror | Search

2. Security and Authentication

Add Users

		
> use neo
switched to db neo
> db.addUser('neo','chen')
{
        "user" : "neo",
        "readOnly" : false,
        "pwd" : "68ace374737253d87e0ec91d4fcb673d"
}
[conn5] Thu Jul 22 17:48:52 building new index on { _id: 1 } for neo.system.users
[conn5] Thu Jul 22 17:48:52 Buildindex neo.system.users idxNo:0 { name: "_id_", ns: "neo.system.users", key: { _id: 1 } }
[conn5] Thu Jul 22 17:48:52 done for 0 records 0secs
> db.system.users.find()
{ "_id" : ObjectId("4c481404b9db6474d2fcb76f"), "user" : "neo", "readOnly" : false, "pwd" : "68ace374737253d87e0ec91d4fcb673d" }
> db.auth('neo','chen')
1
		
		

Deleting Users

To delete a user:

		
db.system.users.remove( { user: username } )
		
		
comments powered by Disqus