Can't connect to cluster from integrated development environment (Lab)

I’m following the lab instructions to connect to my sandbox cluster, but every attempt I make generates a “Failed to connect” error.

Notes

  • My connection command is mongo "mongodb+srv://sandbox.xoomn5o.mongodb.net/myFirstDatabase" --username m001-student
  • My MongoDB shell version is v4.4.3
  • I’ve whitelisted my IP
  • I can successfully connect from my macbook using mongosh

Here’s the full error message

MongoDB shell version v4.4.3
Enter password: 
connecting to: mongodb://ac-hkhkotk-shard-00-01.xoomn5o.mongodb.net:27017,ac-hkhkotk-shard-00-00.xoomn5o.mongodb.net:27017,ac-hkhkotk-shard-00-02.xoomn5o.mongodb.net:27017/myFirstDatabase?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=atlas-su1srg-shard-0&ssl=true


*** You have failed to connect to a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

Error: connect failed to replica set atlas-su1srg-shard-0/ac-hkhkotk-shard-00-01.xoomn5o.mongodb.net:27017,ac-hkhkotk-shard-00-00.xoomn5o.mongodb.net:27017,ac-hkhkotk-shard-00-02.xoomn5o.mongodb.net:27017 :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1

Appreciate any help

:wave:

Hello @Ben_Gorman and welcome to the MongoDB community forums.

Have you tried setting the IP range of 0.0.0.0/0 to test to see if the MongoDB University IDE can connect to your cluster? I know you added your IP address, but the web based IDE (I assume that’s what you’re having issues with) will be using a different IP address. You can set that to expire after a certain period by toggling the This entry is temporary and will be deleted in xxx slider. 6 hours is the smallest amount of time, but it allows you to not have to worry to remember to remove that entry later.

Give that a try and see if you can then continue on with your course using the IDE.

One thing to note is that you don’t have to use the IDE to complete the course. That is there for those who don’t want to install software on their local machines. If you’ve got mongosh or Compass installed locally already, you can use those tools. Doing this, there would be no need to allow any IP other than your local IP.

2 Likes

Derp, how did I miss this? Thank you!

you don’t have to use the IDE to complete the course.

That’s great.

1 Like