Error while Connecting to Our Class Atlas Cluster from the mongo Shell

E QUERY [js] SyntaxError: invalid decrement operand @(shell):1:0

Please share the exact command you are using to connect. Here is the command I use to connect:

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

Also, make sure you don’t run it from mongo shell, run from your Operating system.

Kanika

2 Likes

hello good morning ,

Thanks for your response, it works successfully ! Actually I was running that command in mongodb shell .

1 Like

How do you find the replicaSet name to create the command? I had cluster0-shard-0 and it would not connect. Simply uppercasing the first letter to Cluster0-shard-0 did the trick.

Hi ,

from the UI i got this "mongo “mongodb://sandbox-shard-00-00-os8ro.mongodb.net:27017,sandbox-shard-00-01-os8ro.mongodb.net:27017,sandbox-shard-00-02-os8ro.mongodb.net:27017/test?replicaSet=Sandbox-shard-0” --ssl --authenticationDatabase admin --username --password " and updated username and password as shown in the lecture like below
mongo “mongodb://sandbox-shard-00-00-os8ro.mongodb.net:27017,sandbox-shard-00-01-os8ro.mongodb.net:27017,sandbox-shard-00-02-os8ro.mongodb.net:27017/test?replicaSet=Sandbox-shard-0” --ssl --authenticationDatabase admin --username m001-student --password m001-mongodb-basics

i am not able to conect. can any one please help

thanks,
Akhil y

Hi @ayakhil,

Please share the error you are getting. Make sure you have your IP whitelisted and you are able to ping sandbox-shard-00-00-os8ro.mongodb.net from your system.
Make sure user m001-student exists on your sandbox.

Kanika

Hi Kanika,

This is the error what i am seeing
MongoDB shell version v4.1.8

Enter password:

connecting to: mongodb://sandbox-shard-00-00-os8ro.mongodb.net:27017,sandbox-shard-00-01-os8ro.mongodb.net:27017,sandbox-shard-00-02-os8ro.mongodb.net:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=Sandbox-shard-0

2019-03-04T20:02:22.192-0700 I NETWORK [js] Starting new replica set monitor for Sandbox-shard-0/sandbox-shard-00-00-os8ro.mongodb.net:27017,sandbox-shard-00-01-os8ro.mongodb.net:27017,sandbox-shard-00-02-os8ro.mongodb.net:27017

2019-03-04T20:02:22.193-0700 I ASIO [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-00-os8ro.mongodb.net:27017

2019-03-04T20:02:22.193-0700 I ASIO [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-01-os8ro.mongodb.net:27017

2019-03-04T20:02:22.193-0700 I ASIO [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-02-os8ro.mongodb.net:27017

Implicit session: session { “id” : UUID(“dcca9375-d261-4cb3-afcb-8169aca140a2”) }

MongoDB server version: 4.0.6

WARNING: shell and server versions do not match

Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]

i was thinking to check again the course video but i am not able to access , it is showing 500 internal error

What are the permissions for the user: m001-student ?

These are just warning messages, you can continue with the shell.

The videos are back now, please check and let me know if you are still facing the issue.

Also, this is a development release, I will recommend downloading/installing 4.06 version.

Kanika


I am not able to connect from my sandbox to mongo shell in my system
I am used the URL generated from Atlas

Did it work before or is it the first time you are trying?
Are you able to ping the host
May be some firewall or network issues preventing connection

i tried it after several times and it connected
Thank you