Error: Could not find host matching read preference { mode: "primary", tags: [ {} ] } for set Cluster0-shard-0 :

plaease somebody help!
I connected to mongodb compass ,no problem. but when i am trying to connect by command prompt,
with this command: 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/test?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
— it says:

C:\Users\nzedginidze>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/test?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
2019-10-15T10:48:28.221+0400 W CONTROL [main] Option: ssl is deprecated. Please use tls instead.
MongoDB shell version v4.2.0
connecting to: 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/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0
2019-10-15T10:48:28.403+0400 I NETWORK [js] Starting new replica set monitor for 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
2019-10-15T10:48:28.404+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:28.404+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-10-15T10:48:28.405+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-00-jxeqq.mongodb.net:27017
2019-10-15T10:48:29.566+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:29.904+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:30.686+0400 I NETWORK [js] Successfully connected to cluster0-shard-00-00-jxeqq.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00-jxeqq.mongodb.net:27017 with a 0 second timeout)
2019-10-15T10:48:30.910+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:31.172+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:32.334+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:32.404+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:33.409+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:33.672+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:34.835+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:35.173+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:36.335+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:36.404+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:37.409+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:37.673+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:38.834+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:39.174+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:40.336+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:40.405+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:41.411+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:41.676+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:42.838+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:43.177+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:44.338+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:44.405+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:45.410+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-15T10:48:45.676+0400 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-jxeqq.mongodb.net:27017
2019-10-15T10:48:46.838+0400 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0

*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

2019-10-15T10:48:46.922+0400 E QUERY [js] Error: Could not find host matching read preference { mode: “primary”, tags: [ {} ] } for set Cluster0-shard-0 :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2019-10-15T10:48:46.929+0400 F - [main] exception: connect failed
2019-10-15T10:48:46.931+0400 E - [main] exiting with code 1

C:\Users\nzedginidze>

i have succesfullyu instaled mongo,with the variable parameters also, and i can go with mongo shell.
This is not firewall isue, i already check with netadmin, this is not also antivirus issue.
any ideas else?
have somebody any expirience?

Hi @Nana_08979,

I believe the error is due to some network/firewall related issue. I know you have verified it from your end but can you please do the following ?

  1. Make sure you are able to ping the cluster by running this command in your command prompt and share the output.

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

  1. Are you on a corporate network or using a VPN connection ?

If yes, then please try to contact your IT department and see if there is any workaround or try to make connection from some other location such as your home network.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

here it is:
Pinging ec2-34-195-121-130.compute-1.amazonaws.com [34.195.121.130] with 32 bytes of data:
Reply from 34.195.121.130: bytes=32 time=172ms TTL=43
Reply from 34.195.121.130: bytes=32 time=171ms TTL=43
Reply from 34.195.121.130: bytes=32 time=172ms TTL=43
Reply from 34.195.121.130: bytes=32 time=171ms TTL=43

Ping statistics for 34.195.121.130:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 171ms, Maximum = 172ms, Average = 171ms

Hi @Nana_08979,

Can you please verify this ?

Thanks,
Shubham Ranjan
Curriculum Support Engineer

It is not the network issue, access is open.
any other ideas? By the way i have same problem from my home network

Hi @Nana_08979,

I am able to connect to the cluster using this connection string.

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

I am aware that some of the basic tests are passing on your system but those are not enough to confirm that network/firewall is not an issue. I still believe there is some connection related issue from your end.

I can verify atleast this that there is no issue at the server end. It is up and running and publicly accessible.

If nothing works out then you can import the dataset on your local machine to practice the query and continue with the course. For importing the dataset locally, please refer this post.

Hope it helps!

If you have any other query please feel free to get back to us.

Thanks,
Shubham Ranjan
Curriculum Support Engineer