- 进入切换到某一个数据库,我这里是位每个模块分配一个DataBase
use 0
- 执行添加账号命令
db.createUser(
{
user: "*****",
pwd: "*****",
roles: [{role: "readWrite", db: "peper_test"}]
}
) 具体参数参见官方文档 https://docs.mongodb.com/manual/reference/system-roles-collection/
use 0
db.createUser(
{
user: "*****",
pwd: "*****",
roles: [{role: "readWrite", db: "peper_test"}]
}
)
具体参数参见官方文档 https://docs.mongodb.com/manual/reference/system-roles-collection/