MongoDB Atlas:不允许用户在system.indexes上执行操作查找

问题描述 投票:2回答:1

我正在使用MongoDB Atlas,我最近开始在我的MongoDB副本上出现此错误:

用户不允许在[mydb.system.indexes]上执行[find]操作

什么都没有改变,所以我想知道什么是问题。用户在readWrite上有mydb角色,从docs看起来它应该有权这样做。此外,我试图将用户更改为具有任何权限的管理员用户,但仍然出现此错误。有趣的是system集合在mydb中不存在,但Spring Data试图查询它并得到此错误。

这是mongo的完整日志:

Error: error: {
    "ok" : 0,
    "errmsg" : "user is not allowed to do action [find] on [mydb.system.indexes]",
    "code" : 8000,
    "codeName" : "AtlasError"
}

MongoDB连接URI如下所示:

spring.data.mongodb.uri=mongodb+srv://[USER]:[PASSWORD]@[MONGO_URL].mongodb.net/mydb

我正在使用Spring Boot 2.0.1.RELEASE和版本3.6.3的mongo java驱动程序。 Mongo复制品的版本是3.4.14。知道发生了什么以及如何解决这个问题?升级用户角色在这里没有帮助。

mongodb spring-data-mongodb mongo-java mongo-java-driver mongodb-atlas
1个回答
2
投票

MongoDB Atlas禁止直接调用某些system.集合,并指定在the docdb.<COLLECTION>.getIndexes()中应该使用。在我的情况下,MongoBee库正在进行system.indexes调用并导致问题。有关详细信息,请参阅我的回答here

© www.soinside.com 2019 - 2024. All rights reserved.