Can't connect to servers in my MongoDB Atlas Cluster

Trying to connect to my app and I’m getting this error:
'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/',

I checked the option for allowing access to all IPs and have confirmed it’s open, and I’ve also gone through the other troubleshooting tips, tried changing password, etc. I’m not using Namecheap, which appears to be what some others were using and getting this error.

Here’s my app where I’m calling it using Mongoose.

mongoose.connect(
  process.env.MONGODB_URI,
  {
    useFindAndModify: true,
    useUnifiedTopology: true,
    useNewUrlParser: true,
    useCreateIndex: true,
  },
  (err) => {
    if (err) return console.log("Error: ", err);
    console.log(
      "MongoDB Connection -- Ready state is:",
      mongoose.connection.readyState
    );
  }
);

Any more ideas of what I’m doing wrong?

1 Like

Hi @Brittany_Joiner welcome to the community.

Could you share the MongoDB URI you used? Please remove any username/passwords in the URI beforehand.

Also have you tried connecting using the mongo shell?

Best regards,
Kevin