Unable to connect MongoDB compass

Hi, I have installed the mongoDB compass. When i am trying to connect to the server, it is giving error “Could not connect to MongoDB on the provided host and port” though PORT is reachable.
Please help!

Please try running this command from the terminal / command line:

 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/video?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

If you are able to connect from the above command, then view this post if it help you: About the Chapter 1: Compass Connection [Solution]



What if one is unable to connect from the command line also?

My command line gives this:
2019-02-23T15:26:45.428+0100 E QUERY [js] Error: connect failed to replica set Cluster0-shard-0/cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017 :
exception: connect failed

Hi @Toyyib_52111,

Please share the command you are using to connect.

Also, check if your network is not blocking request.

~$ telnet cluster0-shard-00-00-jxeqq.mongodb.net 27017
Connected to ec2-34-195-121-130.compute-1.amazonaws.com.

  • Also, can you go to your browser and try http://cluster0-shard-00-00-jxeqq.mongodb.net:27017/ . The output should be:
    It looks like you are trying to access MongoDB over HTTP on the native driver port.
    If you get the above message, then that means you can access Atlas.
  • Incase, your network is blocking the request, it would be advisable to work with your network admin to unblock the request or try from your home network.


Seems like the network is unstable. :frowning:

Can you please try running the mongo connection command from another system or with good network?


but my command prompt shows me that my shell and server versions are not same what does it mean

Hi @jalpa_46920,

You can safely ignore this warning message. Let me know if you are having any other issue.

Shubham Ranjan
Curriculum Services Engineer

not at present.

Closing this thread as there are no unresolved issues and the thread is old.