我已将auth添加到我的MongoDB实例中。我使用以下命令创建了一个用户
db.createUser(
{ user: "cocodrile", pwd: "amazonas",
roles: [
{ role: "userAdminAnyDatabase", db: "admin"},
{ role: "dbOwner", db: "admin"},
{ role: "dbOwner", db: "brasil_database"},
{ role: "dbOwner", db: "usa_database"} ,
{ role: "dbOwner", db: "argentina_database"},
{ role: "dbOwner", db: "test"}] })
我想执行 db.fsyncLock(),它说:
db.fsyncLock()
{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { fsync: 1.0, lock: true }",
"code" : 13
}
我做错了什么? 谢谢!