Unable to connect to Atlas Cluster from Mongo Shell through command prompt

Hi,

I tried connecting using the lecture notes.

MongoDB Enterprise > 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-09-01T17:41:23.583+0530 E QUERY [js] uncaught exception: SyntaxError: unexpected token: string literal :
@(shell):1:6
MongoDB Enterprise >

I got this error. Can anyone please advice and help out?

Thanks.
Chaitanya

The mongo command is what you use to start a mongo shell. The text MongoDB Enterprise > shows that you are already in the mongo shell.

1 Like

I am unable to connect to our class cluster, everytime i try it, i get the uncaught exception error. Can you please advice?

Do not type

at the prompt

You type it at the windows prompt.

1 Like

Thank You, it works perfectly.

Hi @chaitanya_98624,

You have posted the same issue on a different thread. As I can see, your issue has been resolved so I’m going to delete your other post.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

I am getting following error while connecting my sandbox cluster:

vagrant@m103:~ mongo "mongodb://sandboxcluster0-shard-00-00-7wfc7.mongodb.net:27017,sandboxcluster0-shard-00-01-7wfc7. mongodb.net:27017,sandboxcluster0-shard-00-02-7wfc7.mongodb.net:27017/test?replicaSet=SandboxCluster0-shard-0" --ssl -- authenticationDatabase admin --username m001-student --password MongoDB shell version v3.6.11 connecting to: mongodb://sandboxcluster0-shard-00-00-7wfc7.mongodb.net:27017,sandboxcluster0-shard-00-01-7wfc7.mongodb.net:27017,sandboxcluster0-shard-00-02-7wfc7.mongodb.net:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=SandboxCluster0-shard-0 2019-09-02T13:38:49.964+0000 I NETWORK [thread1] Starting new replica set monitor for SandboxCluster0-shard-0/sandboxcluster0-shard-00-00-7wfc7.mongodb.net:27017,sandboxcluster0-shard-00-01-7wfc7.mongodb.net:27017,sandboxcluster0-shard-00-02-7wfc7.mongodb.net:27017 2019-09-02T13:39:09.984+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] getaddrinfo("sandboxcluster0-shard-00-01-7wfc7.mongodb.net") failed: Temporary failure in name resolution 2019-09-02T13:39:09.988+0000 I NETWORK [thread1] **getaddrinfo("sandboxcluster0-shard-00-00-7wfc7.mongodb.net") failed: Temporary failure in name resolution** 2019-09-02T13:39:30.007+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] getaddrinfo("sandboxcluster0-shard-00-02-7wfc7.mongodb.net") failed: Temporary failure in name resolution 2019-09-02T13:39:30.008+0000 W NETWORK [ReplicaSetMonitor-TaskExecutor-0] Unable to reach primary for set SandboxCluster0-shard-0 2019-09-02T13:39:30.008+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor-0] Cannot reach any nodes for set SandboxCluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 1 checks in a row. 2019-09-02T13:39:30.009+0000 E QUERY [thread1] Error: connect failed to replica set SandboxCluster0-shard-0/sandboxcluster0-shard-00-00-7wfc7.mongodb.net:27017,sandboxcluster0-shard-00-01-7wfc7.mongodb.net:27017,sandboxcluster0-shard-00-02-7wfc7.mongodb.net:27017 : connect@src/mongo/shell/mongo.js:263:13 @(connect):1:6 exception: connect failed vagrant@m103:~

Hi @DEBASISH_80204,

Can you please ensure that you have enabled connection from all locations in the IP whitelisting section?

Please use this connection string after substituting the value of password in it to connect to your cluster and then share the results if any errors throws up.

mongo "mongodb://sandboxcluster0-shard-00-00-7wfc7.mongodb.net:27017,sandboxcluster0-shard-00-01-7wfc7.mongodb.net:27017,sandboxcluster0-shard-00-02-7wfc7.mongodb.net:27017/test?replicaSet=SandboxCluster0-shard-0" --ssl --authenticationDatabase admin --username m001-student --password <password> 

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Yes i have added my local machine IP also, But Still facing the same problem…

** NETWORK [ReplicaSetMonitor-TaskExecutor-0] getaddrinfo(“sandboxcluster0-shard-00-00-7wfc7.mongodb.net”) failed: Temporary failure in name resolution **

Its also failing here as well
“vagrant@m103:~$ mongo “mongodb+srv://sandboxcluster0-7wfc7.mongodb.net/test” --username m001-student
DNSHostNotFound: Failed to look up service “_mongodb._tcp.sandboxcluster0-7wfc7.mongodb.net”: Connection timed out
try ‘mongo --help’ for more information”

Hi @DEBASISH_80204,

Please check your discourse inbox.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Thank you for deleting it, appreciate your help in managing this board. Happy Ganesh Chaturthi

Hi,

I have such traceback:

KERNELBASE.dll RaiseException+0x69
VCRUNTIME140.dll CxxThrowException+0xad
mongo.exe MallocExtension::GetMemoryReleaseRate+0x1ece40
mongo.exe MallocExtension::GetMemoryReleaseRate+0x1ecc1f
mongo.exe tc_mallopt+0xa52c
mongo.exe mozilla::detail::MutexImpl::~MutexImpl+0x866f
mongo.exe mozilla::detail::MutexImpl::~MutexImpl+0x2317
mongo.exe mozilla::detail::MutexImpl::~MutexImpl+0x8de5
mongo.exe tcmalloc::Log+0xaaf14
KERNEL32.DLL BaseThreadInitThunk+0x14
2019-09-20T13:27:22.081+0300 I CONTROL [main] writing minidump diagnostic file C:\Program Files\MongoDB\Server\4.2019-09-20T10-27-22.mdmp
2019-09-20T13:27:22.229+0300 F CONTROL [main] *** immediate exit due to unhandled exception

Ping to cluster is ok.

Hi @Dmitry_52309,

You have asked the same question here. So I am going to close this thread and respond on the new thread.

Thanks,
Shubham Ranjan
Curriculum Support Engineer