S. V
S. V

Reputation: 1245

Sails js, error when connect to cloud mongodb

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:[email protected]: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.)

Upvotes: 0

Views: 533

Answers (1)

Anthony
Anthony

Reputation: 212

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).

Upvotes: 2

Related Questions