mongodb创建超级用户和普通用户(对应数据库的用户)

use admin
db.createUser({user: "admin", pwd:"password", roles: [{role: "root", db: "admin"}]})

use dbtest
db.createUser({user: "test", pwd: "password", roles: [{role: "readWrite", db: "dbtest" }]})

评论

this is is footer