I deployed my nodejs(expressjs) app to the openshift server. I am hitting a mongoError "MongoError: auth fails", I am providing credentials to mongodb server. Initially when node child process starts it is trying to connect to the
"http://mongodbadmin:XXXXXX@ip:port" but it should connect to "http://mongodbadmin:XXXXXX@ip:port/admin" as credentials reside in admin.system.users collection. I am using mongoose to connect to mongoDB so I changed my mongoose connect to mongoose.connect(http://mongodbadmin:XXXXXX@ip:port/admin); But I still see child process is trying to connect to this url "http://mongodbadmin:XXXXXX@ip:port", but later point of time it connects to the correct collection, and I can see the console ouput of the following code.
mongoose.connection.once('connected', function() {
console.log("Connected to database G")
});
I tested few routes, they are working fine. I want to understand why is it behaving so and can I ignore this error or how can I resolve this issue??
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire