angular - 蒙哥错误: user is not allowed to do action

标签 angular mongodb loopbackjs

我正在使用 MongoDB Atlas 作为我的数据库。

我正在使用带有环回的 angular4 作为 api。

我的应用程序可以正常连接到我的数据库。但是,当我尝试获取数据时,出现此错误(我已将我的 dbname 替换为 dbname):

MongoError: user is not allowed to do action [find] on [dbname.$cmd]

如果我使用本地 mongodb 客户端或 AWS 上的 mongodb 实例,查询工作正常。但是,在使用 atlas 时,出现此错误。

最佳答案

呃!这花了太多时间来修复!对于那些有同样问题的人。我必须同时做这两件事:

1> 我有这个错误,我的问题是在处理连接字符串时我没有将数据库名称从“test”更改为我自己的数据库。 – Meier 17 年 12 月 8 日 12:43

2>

"mongodb://:@cluster0-shard-00-00- rb899.mongodb.net:27017,cluster0-shard-00-01- rb899.mongodb.net:27017,cluster0-shard-00-02- rb899.mongodb.net:27017/?ssl=true&replicaSet=Cluster0-shard- 0&authSource=admin"

此外,在 Atlas 中,您必须指定较旧的驱动程序 2.2.12 或更高版本。完成这些事情后,它终于成功了。

谢谢大家!

关于angular - 蒙哥错误: user is not allowed to do action,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46649390/

相关文章:

mysql - LAMP 和 MEAN 堆栈中没有特定的读取性能差异

javascript - 代码在生产环境和本地环境中表现不同

javascript - Loopback相关模型属性问题

angular - 将参数传递给 mat-dialog 打开方法

java - 如何使用 Java 在 MongoDB 中将子文档(如果不存在)添加到数组字段?

mongodb - 使用 MongoDB 的 map reduce 选择不同的多个字段

node.js - loopbackjs:将模型附加到不同的数据源

angular - 订阅者没有收到来自 .next() 的值

angular - Angular CLI 和快速入门有什么区别?

html - Angular *ngFor 生成表 4 个单元格宽