Error at connecting to MongoDb Atlas Server

I also had a similar issue, and I was able to solve it by adding my white-listing my IP address under Clusters -> security -> IP Whitelist. Instead of clicking my current ip address, just search what's my ip on google and paste that instead. I hope it works!


It's an issue of your "IP Whitelist". Edit and update it once, it should work fine then.


if you are using mongoose previous to version 5.0.15:

the mongodb+srv:// uri is not valid to the underlying native driver.

just removing the +srv will not work either, as the uri will need to include your replica hosts and the replicaSet/authSource parameters.

you can either

1. Upgrade to mongoose 5.0.15 and use the shorter +srv format

or

2. Use your current version with the full uri from your Atlas cluster dashboard, selecting the older driver (see Note below) version uri.

from your cluster dashboard, press the connect button, then (assuming you have whitelisted your node server's IP ) select "connect your application", then press "I am using 3.4 driver or older". Use the resulting uri string substituting your password.

Note: In the dialog for choosing your URI string in the connect helper on the Atlas cluster dashboard, it says "I am using driver 3.* or (newer|older)". This is a poor choice of words, as the 3.6 and 3.4 don't refer to the driver version, but the server version. Further, using one version of the server or the other has nothing to do with the driver being used to connect, which is where the actual dependency lies that determines which version of the URI to use.


I have had this issue connecting to a MongoDB Atlas cluster. I have had to resolve this issue twice because I was working on a project from two different computers (a Macbook Pro and a Windows PC).

Here is my comprehensive answer for everything that I have figured out to resolve the issue of my application not connecting to the cluster.

First Make sure your IP is whitelisted like the above suggestions. The easiest solution is the "All IPs" whitelist of 0.0.0.0/0

Second Check your VPN if you are using one. I was trying to connect to the cluster while connected to a VPN. Once I turned off my VPN, I was able to connect.

Third Make sure your internet settings are not preventing you from connecting to the cluster. My home Xfinity wifi security settings were set too high and this was preventing the connection. I think the router was not allowing a connection to port 27017. One way to test if this issue is occurring is to tether your computer to your phone for internet instead of your wifi and try connecting. I was able to connect using my iPhone as a hotspot for internet. I reset my router to factory settings which fixed the issue.