Getting Connection time out error while connecting through Mongo DB cluster

Hello,
I have followed the instruction provided in the course while installing the compass and now I am trying to put connection string to connect to DB using below string:
mongodb+srv://m001-student:m001-mongodb-basics@cluster0-jxeqq.mongodb.net/test
But I am getting connection time out error.
Can I get help on this?

Can you connect by shell?
May be temporary network issues or some firewall issue
Are you trying from office or home?
Try another internet connection and see

Can you ping cluster?

ping cluster0-shard-00-00-jxeqq.mongodb.net

HI Ramchandra,
Thank you for your reply, I am able to ping the cluster but If I am using connection string, its not working.
Even when I am trying through Mongo shell, I am getting error as Unexpected token - string literal as attached

.
Are there steps I need to follow before opening Compass?

There is no issue with your shell connection
Please watch closely your snapshot.
You are already connected to mongodb and you are trying the mongo command again at mongo prompt.It will not work and it is the reason you are getting syntax/string literal error

Regarding compass did you check if any vpn/anti virus blocking?
What version of Compass are you using?
Please show screenshot of how you are connecting

Thank you for your reply. When I am putting the command as motioned

in the course it just gives 3 dots.
Not sure what to do after that.

And about Mongo Compass its giving error as Connection time Out.

Did you meant in the shell?
You are at mongo prompt(> indicates mongo prompt).Exit and run the command at your os prompt

Regarding Compass timeout issue choose lower version of shell connect string or use the option “fill in connection fields individually” you see on the right side of your snapshot

Hi @Sneha_Kanikdale,

I hope you found @Ramachandra_37567’s response helpful.

For mongo shell connection issues :

You are supposed to run the mongo "mongodb+srv://...... command at your OS prompt. In the screenshot, it appears that you are inside mongo shell. You can exit out of it by running exit command.

Regarding connection issue in Compass :

Try this connection string : mongodb+srv://m001-student:m001-mongodb-basics@cluster0-jxeqq.mongodb.net/test

~ Shubham

Hi shubham,
Yes it really helps.
But now I am getting below mentioned error and suggesting to whitelist the IP address. the error I am getting in normal CMD, not mongo shell.
What should I do next to access cluster, how can I white list the IP address of my machine?

Hi Ramchandra,
What do you mean by lower version of shell connect string in your last comment?

Regarding Compass timeout issue choose lower version of shell connect string or use the option “fill in connection fields individually” you see on the right side of your snapshot

On the Atlas page where you get the connect string there is drop down button to select shell version.I was suggesting to use 3.6
For second one please see your snapshot above.There is blue text to right “fill in …fields” Click on it
Looks like even the connect string given by Shubham not working for you
I think your network not supporting SRV type connect string
Try google DNS.Check our forum threads

Hi @Sneha_Kanikdale,

Try this connection string and let me know if it doesn’t work :

mongo "mongodb://cluster0-shard-00-00.jxeqq.mongodb.net:27017,cluster0-shard-00-01.jxeqq.mongodb.net:27017,cluster0-shard-00-02.jxeqq.mongodb.net:27017/<dbname>?replicaSet=Cluster0-shard-0" --ssl --authenticationDatabase admin --username m001-student --password m001-mongodb-basics

Hi Shubham,
Thank you for help. I am able to connect from different machine now and its working fine.