Can't connecting to My Sandbox Cluster with 'mongo "mongodb+srv://........'

for 3.4 or earlyier version command I can connect to my Sandbox Cluster
mongo “mongodb://cluster0-shard-00-00-y9smy.mongodb.net:27017,cluster0-shard-00-01-y9smy.mongodb.net:27017,cluster0-shard-00-02-y9smy.mongodb.net:27017/test?replicaSet=Cluster0-shard-0” --ssl --authenticationDatabase admin --username --password
for 3.6 or later version command I can not connect to my Sandbox Cluster
mongo “mongodb+srv://cluster0-y9smy.mongodb.net/test” --username

the prompt is :
DNSHostNotFound: Failed to look up service “”:鐢变簬瓒呮椂鏃堕棿宸茶繃锛岃鎿嶄綔杩斿洖銆
try ‘mongo --help’ for more information

Are you able to ping the hostname?
hostname in second command looks different
Please double check

I am not able to ping the second hostname:cluster0-y9smy.mongodb.net.

Make sure your network is not blocking the request. Check your anti-virus / firewall. Also, if you are working from office machine, try using home machine.

and please check this post: Compass Connection [Solution]

Let me know if does not work for you.

Kanika

This command is able to connect to server and mongodb compass is ok to. So that I am sure my computer is not block the request.

however ,the command below is not work for me.
for 3.6 or later version command I can not connect to my Sandbox Cluster
mongo “mongodb+srv://cluster0-y9smy.mongodb.net/test” --username

I also can’t connecting to My Sandbox Cluster with shell…

This command funciona correctamente:

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

Haciendo ping a cluster0-shard-00-00-xzdsd.mongodb.net [3.212.227.127] con 32 bytes de datos:
Respuesta desde 3.212.227.127: bytes=32 tiempo=129ms TTL=49
Respuesta desde 3.212.227.127: bytes=32 tiempo=128ms TTL=49
Respuesta desde 3.212.227.127: bytes=32 tiempo=132ms TTL=49
Respuesta desde 3.212.227.127: bytes=32 tiempo=128ms TTL=49

Estadísticas de ping para 3.212.227.127:
Paquetes: enviados = 4, recibidos = 4, perdidos = 0
(0% perdidos),
Tiempos aproximados de ida y vuelta en milisegundos:
Mínimo = 128ms, Máximo = 132ms, Media = 129ms

However this other not work:

mongo "mongodb://cluster0-shard-00-00-xzdsd.mongodb.net:27017,cluster0-shard-00-01-xzdsd.mongodb.net:27017,cluster0-shard-00-02-xzdsd.mongodb.net:27017/test?replicaSet=Cluster0-shard-0” --ssl --authenticationDatabase admin --username m001-student

but strangelyenough

this command work ok:

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

MongoDB shell version v4.0.8
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/100YWeatherSmall?authSource=admin&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0
2019-04-15T16:59:06.093+0200 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-04-15T16:59:06.790+0200 I NETWORK [js] Successfully connected to cluster0-shard-00-01-jxeqq.mongodb.net:27017 (1 connections now open to cluster0-shard-00-01-jxeqq.mongodb.net:27017 with a 5 second timeout)
2019-04-15T16:59:06.800+0200 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02-jxeqq.mongodb.net:27017 (1 connections now open to cluster0-shard-00-02-jxeqq.mongodb.net:27017 with a 5 second timeout)
2019-04-15T16:59:07.541+0200 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 5 second timeout)
Implicit session: session { “id” : UUID(“d6388db4-1b7b-4350-8901-b117bb128a67”) }
MongoDB server version: 3.6.12
WARNING: shell and server versions do not match
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

Tracert work ok:
C:\Users\Jara>tracert cluster0-shard-00-00-xzdsd.mongodb.net

Traza a la dirección cluster0-shard-00-00-xzdsd.mongodb.net [3.212.227.127]
sobre un máximo de 30 saltos:

1 7 ms 1 ms 6 ms 192.168.1.1 [192.168.1.1]
2 31 ms 29 ms 30 ms 100.82.0.1
3 30 ms 32 ms 28 ms 10.14.1.49 [10.14.1.49]
4 28 ms 28 ms 28 ms 10.14.1.14 [10.14.1.14]
5 29 ms 28 ms 28 ms mad-b2-link.telia.net [213.155.129.70]
6 128 ms 128 ms 129 ms prs-bb4-link.telia.net [80.91.248.130]
7 * 128 ms 143 ms ash-bb3-link.telia.net [62.115.122.159]
8 142 ms 142 ms 143 ms ash-b1-link.telia.net [62.115.143.79]
9 155 ms 128 ms 129 ms vadata-ic-157233-ash-bb1.c.telia.net [62.115.9.70]
10 141 ms 141 ms 143 ms 54.239.108.66
11 129 ms 131 ms 128 ms 52.93.114.25
12 * * * Tiempo de espera agotado para esta solicitud.
13 * * * Tiempo de espera agotado para esta solicitud.
14 * * * Tiempo de espera agotado para esta solicitud.
15 146 ms 145 ms 141 ms 52.93.29.38
16 * * * Tiempo de espera agotado para esta solicitud.
17 * * * Tiempo de espera agotado para esta solicitud.
18 * * * Tiempo de espera agotado para esta solicitud.
19 * * * Tiempo de espera agotado para esta solicitud.
20 * * * Tiempo de espera agotado para esta solicitud.
21 128 ms 128 ms 129 ms ec2-3-212-227-127.compute-1.amazonaws.com [3.212.227.127]

Traza completa.

Telnet don’t work:

Microsoft Telnet> open cluster0-shard-00-00-xzdsd.mongodb.net
Conectándose a cluster0-shard-00-00-xzdsd.mongodb.net…No se puede abrir la conexión al host, en puerto 23: Error en la conexión
Microsoft Telnet>

there is the solution: