johnny bravo
johnny bravo

Reputation: 21

MongoError: Authentication failed. - trouble connecting to MongoLab

I am trying to connect to MongoLab (sandbox). I'm using MEAN.

I've put the development and production strings inside mongo={} in credentials.js file. But I'm not sure how to put database username and password. I can see my username and pass on MongoLab website, but I'm unsure of the format to use, can you please leave an example?

Upvotes: 0

Views: 270

Answers (1)

villeaka
villeaka

Reputation: 2983

See the official documentation. The connection URI is formatted like this:

mongodb://<dbuser>:<dbpassword>@ds012345-a0.mongolab.com:56789/sample-db

You'll find the correct URI to your database on your admin page in Mongolab.

Upvotes: 1

Related Questions