I have installed mongoDB on the same droplet as my node.js application in the root folder. But when i try to connect to my mongoDB database it is failing. It is telling me “Err too many redirects”. I am using the following line to try to connect with mongoose: mongoose.connect(“mongodb://username:password@127.0.0.1:27017?authSource=admin”, {useNewUrlParser: true });

In the UFW i have allowed income on my droplet IP and 27017.

Hope one of you can tell me what is wrong.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Have you started Mongo Server?

Can you connect it through command line like?

mongo -u username -p password --authenticationDatabase admin
Submit an Answer