Home > database >  error while connecting to MongoDB Atlas using Mongoose
error while connecting to MongoDB Atlas using Mongoose

Time:12-10

I am getting this error while connecting to MongoDB Atlas using Mongoose. Firstly I tried using Mongo Client I got the same error. Then I switched to mongoose, it was working fine but suddenly it stopped working. I have already added "allow from anywhere" and my IP in network access.

MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/

CodePudding user response:

You Need to Add your System IP in Atlas where u have created ur database in Atlas.. To whitelist multiple IP addresses, go to your target cluster on MongoDB Atlas. Next, go to Network Access under the Security tab. On the IP Whitelist tab, click on Add IP address. Type your IP address manually under Whitelist Entry, then click Confirm.

CodePudding user response:

Make sure your current IP address is on your Atlas cluster's IP whitelist as given in error message.Follow the steps given in article https://studio3t.com/knowledge-base/articles/mongodb-atlas-login-ip-whitelisting/

  • Related