gpt4 book ai didi

mongodb - 无法在 mongodb 中创建角色

转载 作者:可可西里 更新时间:2023-11-01 10:00:03 27 4
gpt4 key购买 nike

我正在尝试在 mongodb 中创建一个新角色,但出现错误:

> use Admin
switched to db Admin
> db.createRole( { role: "executeFunctions", privileges: [ { resource: { anyResource: true }, actions: [ "anyAction" ] } ], roles: [] } );
2018-03-13T19:59:25.114+0500 E QUERY [thread1] Error: Roles on the 'Admin' database cannot be granted privileges that target other databases or the cluster :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createRole@src/mongo/shell/db.js:1541:1
@(shell):1:1

最佳答案

有时 mongo 使用错误的拼写并在以后制造问题。

所以检查:

use admin
switched to db admin
> db.createRole( { role: "executeFunctions", privileges: [ { resource: { anyResource: true }, actions: [ "anyAction" ] } ], roles: [] } );

关于mongodb - 无法在 mongodb 中创建角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49259472/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com