Could not able to connect the hostname

Hi @Shah_02826,

Can you please make sure you are able to ping the cluster by executing the command mentioned below?

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

Additionally, it could be your firewall/anti-virus that might be blocking the requests. So, I would recommend you to try to connect from some other network such as your home network.

If the issue still persists, please feel free to get back to us.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

ping cluster0-shard-00-00-jxeqq.mongodb.net
Ping request could not find host cluster0-shard-00-00-jxeqq.mongodb.net. Please check the name and try again.

Hi @Shah_02826,

As mentioned earlier, I would recommend you to try to connect from some other network. For some reason, your current network is blocking the outgoing requests.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

I tried with other network and Compass connected but shell gave following error.
Microsoft Windows [Version 10.0.17134.407]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\SMI>mongo “mongodb+srv://cluster0-wxsru.mongodb.net/test” --username m001-student --password m001-mongodb-basics
MongoDB shell version v4.2.0
connecting to: mongodb://cluster0-shard-00-02-wxsru.mongodb.net:27017,cluster0-shard-00-01-wxsru.mongodb.net:27017,cluster0-shard-00-00-wxsru.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0&ssl=true
2019-09-24T10:06:02.847+0500 I NETWORK [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-02-wxsru.mongodb.net:27017,cluster0-shard-00-01-wxsru.mongodb.net:27017,cluster0-shard-00-00-wxsru.mongodb.net:27017
2019-09-24T10:06:02.848+0500 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-00-wxsru.mongodb.net:27017
2019-09-24T10:06:02.849+0500 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-02-wxsru.mongodb.net:27017
2019-09-24T10:06:02.849+0500 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-wxsru.mongodb.net:27017
2019-09-24T10:06:19.054+0500 E NETWORK [ReplicaSetMonitor-TaskExecutor] SSL peer certificate validation failed: (800B0109)A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
2019-09-24T10:06:19.061+0500 E NETWORK [ReplicaSetMonitor-TaskExecutor] SSL peer certificate validation failed: (800B0109)A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
2019-09-24T10:06:19.063+0500 W NETWORK [ReplicaSetMonitor-TaskExecutor] DNS resolution while connecting to cluster0-shard-00-01-wxsru.mongodb.net:27017 took 16213ms
2019-09-24T10:06:19.067+0500 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-09-24T10:06:19.067+0500 I NETWORK [ReplicaSetMonitor-TaskExecutor] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 1 checks in a row.

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

2019-09-24T10:06:19.068+0500 E QUERY [js] Error: connect failed to replica set Cluster0-shard-0/cluster0-shard-00-02-wxsru.mongodb.net:27017,cluster0-shard-00-01-wxsru.mongodb.net:27017,cluster0-shard-00-00-wxsru.mongodb.net:27017 :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2019-09-24T10:06:19.073+0500 F - [main] exception: connect failed
2019-09-24T10:06:19.075+0500 E - [main] exiting with code 1

Hi @Shah_02826,

I am able to connect to your cluster using the connection string that you have provided.

mongo "mongodb+srv://cluster0-wxsru.mongodb.net/test" --username m001-student --password m001-mongodb-basics

17%20PM

I think it is a network issue on your end as I mentioned earlier.

Can you please check if you are able to ping the cluster by running this command in your terminal ?

ping cluster0-shard-00-02-wxsru.mongodb.net

I would recommend you to contact your IT department to see if there is a workaround or try to make the request from another location such as your home network.

Thanks,
Shubham Ranjan
Curriculum Support Engineer