Sails js,连接云mongodb时出错 [英] Sails js, error when connect to cloud mongodb

查看:47
本文介绍了Sails js,连接云mongodb时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sails适配器中使用了云MongoDB,但是当我运行应用程序时,它抛出一个错误,有人可以帮忙解决吗?

默认:{适配器:'sails-mongo',url: 'mongodb://USERNAME:PASS@cluster0-shard-00-00.ikncs.mongodb.net:27017,cluster0-shard-00-01.ikncs.mongodb.net:27017,cluster0-shard-00-02.ikncs.mongodb.net:27017/test?ssl=true&replicaSet=atlas-qhs0wy-shard-0&authSource=admin&retryWrites=true&w=majority'}

错误:错误:违反一致性:创建数据库连接管理器时出现意外错误:

MongoError:连接 3 到 cluster0-shard-00-01.ikncs.mongodb.net:27017 已关闭

错误:无法拆除 ORM 挂钩.错误详细信息:错误:违反一致性:试图拆除当前未在此适配器中注册的数据存储区(default).这通常是由于用户态代码中的竞争条件(例如,尝试多次拆除同一个 ORM 实例),或者可能是由于此适配器中的错误.(如果您遇到困难,请访问

I used cloud MongoDB in sails adapter but when I am running app, it throw an error, can someone help how to solve it?

default: {
    adapter: 'sails-mongo',
  url: 'mongodb://USERNAME:PASS@cluster0-shard-00-00.ikncs.mongodb.net:27017,cluster0-shard-00-01.ikncs.mongodb.net:27017,cluster0-shard-00-02.ikncs.mongodb.net:27017/test?ssl=true&replicaSet=atlas-qhs0wy-shard-0&authSource=admin&retryWrites=true&w=majority'
  }

error: Error: Consistency violation: Unexpected error creating db connection manager:

MongoError: connection 3 to cluster0-shard-00-01.ikncs.mongodb.net:27017 closed

error: Could not tear down the ORM hook. Error details: Error: Consistency violation: Attempting to tear down a datastore (default) which is not currently registered with this adapter. This is usually due to a race condition in userland code (e.g. attempting to tear down the same ORM instance more than once), or it could be due to a bug in this adapter. (If you get stumped, reach out at http://sailsjs.com/support.)

解决方案

This looks like you are unable to connect to the cluster hosted on Atlas.

You will need to add your IP to the whitelist on Atlas. In the security section, under Network Access, add your IP to the whitelist (or the IP of the server you're connecting to the cluster from if you are using a remote server).

这篇关于Sails js,连接云mongodb时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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