I am getting the error : error: Error: Consistency violation: Unexpected error creating db connection manager: MongoError: Authentication failed. Password is fine and I am able to connect with MongoExpress from another server and Mongo Compass. I triple checked the password and even copy-pasted the connection URL to make sure it was not a typo error.
I have followed the instructions (https://sailsjs.com/documentation/tutorials/using-mongo-db) but the only difference is I added the password in the URL ('mongodb://user:password@localhost:27017/mydb') as the Sails auto-migrate process was throwing a mongo-error like need Auth to drop.
Mongo db version v4.4.4
sails-mongo 1.2.0
Sails v1.4.2.
--datastore.js
default: {
adapter: 'sails-mongo',
url: 'mongodb://user:password@localhost:27017/mydb',
}
--model.js
attributes: {
//MONGO
createdAt: { type: 'number', autoCreatedAt: true, },
updatedAt: { type: 'number', autoUpdatedAt: true, },
id: { type: 'string', columnName: '_id' },
}
use admin
db.createUser(
{
user: "user",
pwd: passwordPrompt(), // or cleartext password
roles: [ { role: "readWrite", db: "mydb" } ]
}
)
Thanks for any help