Cannot connect to Atlas from MongoDB 4.2

Hi all,

I have the 4.2 Installation of MongoDB database installed on my desktop.

C:\Program Files\MongoDB\Server\4.0\bin>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
MongoDB shell version v4.0.1
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?replicaSet=Cluster0-shard-0
2019-10-05T11:15:03.968+0530 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-05T11:15:14.439+0530 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-10-05T11:15:14.447+0530 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.
2019-10-05T11:15:29.965+0530 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-10-05T11:15:29.970+0530 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 2 checks in a row.
2019-10-05T11:15:29.980+0530 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 :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed

Not sure why this happened. Its a newer version of MongoDB.

@mario_the_legend I’ve just tested it and I can connect. Maybe try again.

Hi @mario_the_legend,

I am able to connect to the cluster using the connection string mentioned below. I suspect this is a network issue.

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

Please make sure you are able to ping and telnet the cluster using the command mentioned below.

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

If the test fails then please try to connect using some other network such as your home network.

Thanks,
Shubham Rajan
Curriculum Support Engineer