MongoDB | 解决命令执行权限不足的方法

问题:

{
    "ok" : 0,
    "errmsg" : "not authorized on admin to execute command 
                 { 
                     dbstats: 1.0, 
                     scale: undefined, 
                     lsid: { id: UUID(\"ea088c48-d889-4aa2-8949-9c48ea6d0a68\") }, 
                     $db: \"admin\" 
                  }",
     "code" : 13,
     "codeName" : "Unauthorized"
}

解决方案:

use admin;

db.grantRolesToUser("", [ { role:"dbOwner", db:""}]);

 

你可能感兴趣的:(MongoDB | 解决命令执行权限不足的方法)