MongoDB用户管理
创建用户 语法: db.createUser( { user:<name_string>, #字符串 pwd:<password_strin>, #字符串 roles:[{role:<role_name>,db:<db_name>}] #数组 } ) 创建用户: > db.createUser( ... { ... user:"root", ... pwd:"admin", ... roles:[{role:"root",db:"admin"}] ... } ... ) 用户验证: > db.auth("root","admin") 1 查看用户: 删除用户 db.dropUser(<user_name>) #删除某个用户,授受字符串参数 db.dropAllUsers() #删除当前库的所有用户 查询所有用户 > db.getUsers() [ { "_id" : "admin.root", "user" : "root", "db" : "admin", "roles" : [ { "role" : "root", "db" : "admin" } ] }, { "_id" : "admin.sysadmin", "user" : "sysadmin", "db" : "admin", "roles" : [ { "role" : "root", "db" : "admin"