MongoError:不允许用户对[DB.$ cmd]进行操作[listIndexes] [英] MongoError: user is not allowed to do action [listIndexes] on [DB.$cmd]

查看:85
本文介绍了MongoError:不允许用户对[DB.$ cmd]进行操作[listIndexes]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的API代码使用最新的 Mongoose 5.0.11 和正确的Mongo 3.4连接字符串连接到免费的地图集服务.

My API code is using the latest Mongoose 5.0.11 with the proper Mongo 3.4 connection string to connect to the free Atlas service.

mongodb://someadmin:<PASSWORD>@ascatlas-shard-00-00-6fake.mongodb.net:27017,ascatlas-shard-00-01-6fake.mongodb.net:27017,ascatlas-shard-00-02-6fake.mongodb.net:27017/DB?ssl=true&replicaSet=ascatlas-shard-0&authSource=admin

执行此操作时,初始连接可以正常工作,但是由于无法在"DB数据库"中列出集合中的索引的权限问题而出错.我要连接的用户凭据是Atlas Admin,因此不确定我可以提供哪些其他权限.有什么想法吗?

When it does this, the initial connection works properly, but then errors out with a permissions problem being unable to list the indexes on the collection in the "DB database". The user credentials I'm connecting with is the Atlas Admin, so not sure what other permissions I can provide. Any ideas?

profile:mongoose MongoDB connection established +5s
profile:mongoose profiles ensureIndex { identityID: 1 } { unique: 1, background: true } +5ms

/API-User/node_modules/mongoose/lib/utils.js:423
        throw err;
        ^
MongoError: user is not allowed to do action [listIndexes] on [DB.$cmd]
    at queryCallback (/API-User/node_modules/mongodb-core/lib/cursor.js:223:25)
    at /API-User/node_modules/mongodb-core/lib/connection/pool.js:541:18
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

推荐答案

似乎用户无权访问listIndexes 根据文档

Seems that the user has no permission to listIndexes As per the documentation

所需的访问权限 执行命令的用户需要对system.indexes集合具有find特权,或者需要listIndexes特权操作.至少,内置读取角色提供必要的权限.

Required Access The user executing the command requires either find privileges on the system.indexes collection or the listIndexes privilege action. At a minimum, the read built-in role provide the requisite permissions.

这篇关于MongoError:不允许用户对[DB.$ cmd]进行操作[listIndexes]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆