MongoDB: 未授权数据库执行命令 eval
MongoDB: Not authorized on database to execute command eval
这是我的查询 运行ning:
db.surveyquestion.copyTo('surveyquestionV2')
我得到的错误:
{
"message" : "MongoError: not authorized on GenericSurveyTool to execute command { $eval: function (collName, newName) {\r" +
"var from = db[collName];\r" +
"..., args: [ 'surveyquestion', 'surveyquestionV2' ], $db: 'GenericSurveyTool' }",
"stack" : "script:1:19",
"code" : 13
}
我正在使用 运行 此查询的管理数据库中的用户:
query: db.getUsers();
/* 2 */
{
"_id" : "admin.moiz",
"user" : "moiz",
"db" : "admin",
"roles" : [
{
"role" : "root",
"db" : "admin"
}
]
}
我有此用户的 root 角色,但我仍然无法复制集合。请帮忙!!
遇到同样问题的人,解决方案在db.eval()
的文档中:just right here
If authorization is enabled, you must have access to all actions on all resources in order to run eval. Providing such access is not recommended, but if your organization requires a user to run eval, create a role that grants anyAction on anyResource. Do not assign this role to any other user.
这是我的查询 运行ning:
db.surveyquestion.copyTo('surveyquestionV2')
我得到的错误:
{
"message" : "MongoError: not authorized on GenericSurveyTool to execute command { $eval: function (collName, newName) {\r" +
"var from = db[collName];\r" +
"..., args: [ 'surveyquestion', 'surveyquestionV2' ], $db: 'GenericSurveyTool' }",
"stack" : "script:1:19",
"code" : 13
}
我正在使用 运行 此查询的管理数据库中的用户:
query: db.getUsers();
/* 2 */
{
"_id" : "admin.moiz",
"user" : "moiz",
"db" : "admin",
"roles" : [
{
"role" : "root",
"db" : "admin"
}
]
}
我有此用户的 root 角色,但我仍然无法复制集合。请帮忙!!
遇到同样问题的人,解决方案在db.eval()
的文档中:just right here
If authorization is enabled, you must have access to all actions on all resources in order to run eval. Providing such access is not recommended, but if your organization requires a user to run eval, create a role that grants anyAction on anyResource. Do not assign this role to any other user.