I'm struggling to connect with sails to a mongodb database that uses a database for authentication named "dbadmin". Where I am DBA decided to have all users centralized in a users database.
I can connect to this "dbadmin" database but then sails complains it cannot create collections there.
How can I use an authentication database and then a different database for collections?
It turns out that using the URL for the connection has more possibilities. So all I had to do is append at the end authSource=dbadmin
module.exports = {
models: {
connection: 'mongoRM'
},
connections: {
mongoRM: {
adapter: 'sails-mongo',
url: 'mongodb://user:password@db_url:port/database?authSource=dbadmin'
}
}
}