I created a Sails.js app, it connects to local MongoDB correctly but if I want to connect it to cloud mongodb, Sails throws an error. what should I do to fix it?
default: {
adapter: 'sails-mongo',
// url: 'mongodb://localhost:27017/referral' // this work fine
url: 'mongodb+srv://MYUSERNAME:MYPASS@cluster0.ikncs.mongodb.net/referral?retryWrites=true&w=majority'
},
error:
error: A hook (orm
) failed to load!
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.
error: Error: Invalid configuration for datastore default
: Provided URL ('mongodb+srv://MYUSERNAME:MYPASS@cluster0.ikncs.mongodb.net/referral?retryWrites=true&w=majority') has an invalid protocol.
If included, the protocol must be "mongodb://".
I will appreciate if someone help quickly