MongoDB Compass / connection issue

In M220JS (Chapter 0: Introduction and Setup -> Setting Up Atlas);
for some reason I can’t connect with MongoDB Compass (1.25.0).

I tried both of the following connection strings:

mongodb+srv://m220user:m220password@mflix.cuwiz.mongodb.net/test
mongodb+srv://m220user:m220password@mflix.cuwiz.mongodb.net/admin

In all cases, I get: Authentication failed.

If I set the Network Access to: 0.0.0.0/0 (instead of just my current IP address), though it is not recommended, all the following connection strings work.

mongodb+srv://m220user:m220password@mflix.cuwiz.mongodb.net/test
mongodb+srv://m220user:m220password@mflix.cuwiz.mongodb.net/admin
mongodb+srv://m220user:m220password@mflix.cuwiz.mongodb.net

Your current IP address might not be the one seen by the server. The IP address is most likely a DHCP address assigned to you by your internet provider router. This is not your public address outside your local network. If your using a VPN the address seen by the server is the public connection of the VPN, not the one from your machine.

The easiest what to determine your public IP is with https://www.whatismyip.com/.

Note that most internet provider will change your IP address from time to time to prevent you from hosting servers at your home.

For the courses, it is simpler to allow access from anywhere.

No. I am not putting a private IP, it is the IP detected by Atlas (a public one);
the same as given by https://www.whatismyip.com/.

Anyway after some more trials it looks like it is working (with some users that I created and not some others) at least partly.

" most internet provider will change your IP address from time to time to prevent you from hosting servers at your home"

-> Well you should be able to go around using dynamic DNS.

“For the courses, it is simpler to allow access from anywhere”

Yeah, but this is bad practice. So don’t say that to the teachers or they’ll get angry at you :slight_smile: