> db.addUser("ydkt","ydkt") 2015-06-19T09:22:37.004+0800 E QUERY TypeError: Property 'addUser' of object admin is not a function at (shell):1:4 >
原来在mongodb3.0中addUser已被废弃,具体参考:
http://docs.mongodb.org/manual/reference/method/db.createUser/#create-administrative-user-with-roles
> db.createUser({user:'ydkt',pwd:'ydkt',roles:['readWrite','dbAdmin']}) Successfully added user: { "user" : "ydkt", "roles" : [ "readWrite", "dbAdmin" ] } >