未经数据库授权执行命令-MongoDb

时间:2020-05-07 14:24:31

标签: node.js mongodb express

我最近从mLab迁移到了MongoDb Atlas。现在,当我尝试更新Node.js应用程序中的连接字符串时,无法将新的用户表单发布到数据库中。我收到以下错误:

"not authorised on database to execute command { insert: "users"..."

有人有什么建议吗?

For example, say:
Username = john (all admin read write permissions have been given)
Password = hello
Database cluster = dogs

首先,当我连接下面的字符串时,没有显示数据库:

mongodb+srv://john:hello@dogs-juria.mongodb.net/test?retryWrites=true&w=majority

然后我编辑了字符串,将“测试”更改为“狗”:

mongodb+srv://john:hello@dogs-juria.mongodb.net/dogs?retryWrites=true&w=majority

我现在在我的应用程序上看到该数据库,但是,如果现在尝试从我的网页提交一个新的用户表单,它将显示上述错误。

1 个答案:

答案 0 :(得分:0)

我通过更新基于容器的云平台即服务(PaaS)中的url来解决此问题

相关问题