Sails.js default app fails to start with MongoDb

I created a WebApp with sails new my-app and am trying to use mongodb as its database. I am running mongodb in docker and am able to connect to the database using GUI tools like MongoDB Compass. Using that tool I created todo_list database in mongo.

In the app, I changed default datastore in datastores.js to:

default: {
    adapter: 'sails-mongo',
    url: 'mongodb://root:rootpassword@localhost:27017/todo_list'
}

This connection string is correct as verified by using it to connect via MongoBD Compass.

When I run sails lift I get:

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.  (If you get stumped, reach out at http://sailsjs.com/support.)

I saw this error raised in a few github issues, bu tteh answers were irrelevant to my situation. Any ideas what I could be doing wrong?



Read more here: https://stackoverflow.com/questions/67153092/sails-js-default-app-fails-to-start-with-mongodb

Content Attribution

This content was originally published by Andrey at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: