Reputation: 45
I'm trying to connect mongodb from mlabs. I've inserted the following code:
Mongoose.connect('mongodb://<dhan004>:<password1>@ds163402.mlab.com:63402/projecttwist', {useNewUrlParser: true });
It then gave me this error:
(node:32032) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): MongoError: Authentication failed.
Can anyone explain why I'm getting this error?
Upvotes: 2
Views: 1241
Reputation: 6559
Just remove the brackets(both < and the >) from the username and password section.
For username should use: dhan004
And for the password you should use: password1
So your final db address should be:
Mongoose.connect('mongodb://dhan004:[email protected]:63402/projecttwist', {useNewUrlParser: true });
Upvotes: 2