MongoDB Atlas:不允许用户对 system.indexes 进行操作查找 [英] MongoDB Atlas: user is not allowed to do action find on system.indexes

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

问题描述

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

I'm using MongoDB Atlas and I've recently started to get this error on my MongoDB replica:

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

user is not allowed to do action [find] on [mydb.system.indexes]

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

Nothing really has changed, so I'm wondering what can be an issue. The user has readWrite role on mydb and from the docs it looks like it should have the right to do it. Also, I've tried to change the user to admin user which has any rights, but still got this error. Interesting that system collection doesn't exists in mydb but Spring Data tries to query it and gets this error.

这是来自 mongo 的完整日志:

Here is a full log from mongo:

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

MongoDB 连接 URI 如下所示:

MongoDB connection URI looks like this:

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.知道发生了什么以及如何解决这个问题吗?升级用户角色在这里没有帮助.

I'm using Spring Boot 2.0.1.RELEASE with mongo java driver of version 3.6.3. Version of the Mongo replica is 3.4.14. Any idea what's going on and how this can be fixed? Upgrading user role doesn't help here.

推荐答案

MongoDB Atlas 禁止直接调用某些 system. 集合,他们在 文档db..getIndexes() 应改为使用.在我的情况下,MongoBee 库正在调用 system.indexes 并导致问题.查看我的回答此处了解更多详情.

MongoDB Atlas forbids direct calls to some system. collections and they specify that in the doc and db.<COLLECTION>.getIndexes() should be used instead. In my case MongoBee library was making system.indexes call and causing the issue. See my answer here for more details.

这篇关于MongoDB Atlas:不允许用户对 system.indexes 进行操作查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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