连接后,mongobee 在 Atlas 集群上读取 DBname.system.indexes 失败

Art*_*ist 4 mongodb mongodb-query spring-boot jhipster mongobee

我有一个 Jhipster Spring Boot 项目。最近我从mlabs独立沙箱转移到 Atlas 集群沙箱 M0 免费层副本集。它甚至可以工作,我已经对它进行了一些数据库操作。但是现在由于某种原因然后出现了读取权限错误

Error creating bean with name 'mongobee' defined in class path resource [DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 8000 and error message 'user is not allowed to do action [find] on [test.system.indexes]' on server ********-shard-00-01-mfwhq.mongodb.net:27017
Run Code Online (Sandbox Code Playgroud)

您可以在此处查看完整堆栈https://pastebin.com/kaxcr7VS

我搜索了高低,我能找到的只是 M0 层用户没有权限覆盖我没有做的管理数据库。

即使现在与 Mlabs DB 的连接工作正常,但在 Atlas DB M0 层上存在此问题。

Mongo 数据库版本:3.4

罐子和它的版本名称:'mongobee',版本:'0.10' 名称:'mongo-java-driver',版本:'3.4.2'

@Neil Lunn 我用来连接的用户 ID 是管理员的用户 ID,连接读写通过 shell 或 Robo3T(mongo 客户端)进行

Yur*_*kov 9

在与 MongoDB 支持团队讨论后,MongoDB 3.0 弃用了对system.indexes集合的直接访问,该集合以前用于列出数据库中的所有索引。应用程序应该使用db.<COLLECTION>.getIndexes()。

从MongoDB Atlas 文档可以看出,它们可能禁止调用system.集合:

或者,对于 read 和 readWrite 角色,您还可以指定一个集合。如果不指定read和readWrite的集合,则该角色适用于数据库中的所有集合(不包括一些system.collections)。

从堆栈跟踪可以看出MongoBee正在尝试进行此调用,因此现在是库问题,应该对其进行更新。

更新:为了在MongoBee发布新版本之前解决问题:

  1. 获取MongoBee 的最新资源git clone git@github.com:mongobee/mongobee.git,cd mongobee
  2. 获取拉取请求 git fetch origin pull/87/head:mongobee-atlas
  3. 查看 git checkout mongobee-atlas
  4. 安装 MongoBee jar mvn clean install
  5. 从/target文件夹或本地获取编译的 jar/.m2
  6. 将 jar 用作项目的依赖项