Connecting to Our Class Atlas Cluster Issue

When I typed the command in the video lecture notes " Connecting to Our Class Atlas Cluster from the mongo Shell" I got this message!

[js] SyntaxError: missing ; before statement @(shell):1:6

Am I typing the command at wrong place? Please guide me where exactly I have to paste the command and how to write it.

U are entering the command at the right place… It is just that the syntax in not correct

Can you provide your post with the full syntax of the command you are entering, please

When I tried to watch the video " Connecting to Your Sandbox Cluster from the mongo Shell" I got this:
500 Internal Server Error
Sorry, something went wrong.

A team of highly trained monkeys has been dispatched to deal with this situation.

If you see them, send them this information as text (screenshots frighten them):
APkpgMWiYqkGndMn68rkL1goAjLdUUwEnyHzpBvfLonh_Ua7-kJjHvN_
skE1nlrSUQbXSlXu091P2E73qBozm5KvskjolNvvJLAgbF86feQinJKm
aXvgFNUfPOftGsXmdulIX7ppOfsWCVE0mA9upflPJIjerpGa8ERuhqfW
aEDuiZaI3-F_Np85XoqyENXTvFyrdqt6Mi6cFygU2KSm9GS0JDF8UEij
45Q-EmXIuVFgP2jreo7eEI3L94xi1408fcqo1Qf2XEZE4VI-DxoFcvn6
oPMILXKbu4BypoyoRwRu1y457M7hlZGYLm-aNk4Jvaj29xwNkQ7bTVQA
4bSBsXblN5twGfyb0_oPjTeqsLgmzX8o0lMNi5b7XqzZPEh_ljaQTjQj
jzlGXB6SP5RrwfPp8E5YqzJgiHsN8GSlGh4FUSXxdtKd7RjaqrGE7v5e
j98HSjodt7i0Sw0G_83pPoKjUCnYXcWTX4zRNvZLGtj-zMzfJrcwNn9r
M6FWfTQd6SSatPVvao2MuFP19-a6ytfv9L29iIsxHGeqRCuOtqnGwi-S
ZxBqqtfLr7recrNd4JVSA_WTlpHd0gcTFYFd0-e04J0qts2GruAEJYRZ
3qsypvgSg7pSavF_g0HQWS17_8u2Fgo4Ar8NeciJMS_hkT_r9nIL7bLr
9cwUvtEnZZF2kc6l7HCazbgsV7n88zgkiKVA63OP7bczEE0DnjK-g9IC
mNHA2iWmnvDt5tHlteKBOKSJOqW7wDzQxMWY8Ftxu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8tB4vPj2sQo9R1HGVjsH1
L4jnS55fReDPvZXcNqjmhcTuyVfuQt2OypkTc3xTMYD5pkDKJxNUemGE
jBKCQH7zF_jkIzraQ8jkEsoJn-fTmDMrkJFncXqGBhdY74OrDcKtDCZf
10rKM-GAKnllS_6lLQGfVKl6Sv1Bt3ytLH4fEUVsEZdfx4Cf4hnIgAdi
J0VK8HSXenjcpSsMRlLJJrM0bvms4LnxchkCTjgBW8CI6gOo37_dqLpn
8njUnuUSbHMQaNRpK33uTPMm3yzBfzHjbi2aaxrS9_taH6TPEKijjgtb
0O8wf52SDfAHylvGaC7IZwrleDpET5dRgKZ9A36vAz9zginEs5SWtnSi
qN3MQEjmYnEcPsnNVx2zIHBR4nbONy-vYXm6oa046sVz6c6EUkqJDq-c
UZS4jvwTBH41aX5BT12Uy3ABBHVK41fUn0ZUycHSdvSfW1VDyIYcqYuR
ty8964rNQPqFmgv2-NxCiu6p7Im6polUP4P6wLs

Thanks For helping me!
Here is what I did!


Please help me so that I can continueue…

quit()
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

2 Likes

Hi Mhamza007,

You are running 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 from your mongo shell.

Mongo connection commands need to be run from your OSx terminal window. If you are already in a mongo shell, running mongo connection command won’t work.

Please run it outside the mongo shell and from your command line.

//When you are in mongo shell, type exit.
mongo --nodb
MongoDB shell version v4.0.0
> exit
bye
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

Thanks, Kanika

1 Like

Hi Kanika,

I was getting the same issue and tried the command outside mongo shell but I am getting below error now:

2018-10-17T14:13:24.668+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

Kindly assist.

Hi Jitender_44805,

Error suggests you are running from inside the mongo shell. Please use a new terminal window and try connecting again.

If you have issues in connection, please check here.

Connection error means you are not able to connect to “cluster0-shard-00-00-jxeqq.mongodb.net
Try ping cluster0-shard-00-00-jxeqq.mongodb.net. See, if you are able to connect to the cluster.

Let me know if issue is still there.

Kanika

Hi Kanika,

I am also getting same error. I tried “ping cluster0-shard-00-00-jxeqq.mongodb.net” in command prompt. I am betting below error message.
Ping request could not find host cluster0-shard-00-00-jxeqq.mongodb.net. Please check the name and try again.

Is it some kind of firewall blocking to access the cluster? Or any authentication issue?

I am unable to reach the server using ping, I tried to run compaas which isn’t running today while it was working fine over the weekend. It could probably be due to the fact that I am trying it from Office. I will try it from home network and seek help if any issues.

Thanks

You have to remove http that might have been copied. Just use the hostname and try ping.

~$ ping cluster0-shard-00-00-jxeqq.mongodb.net
PING ec2-34-195-121-130.compute-1.amazonaws.com (34.195.121.130): 56 data bytes
64 bytes from 34.195.121.130: icmp_seq=0 ttl=48 time=307.094 ms

If the network is blocked in your office, you won’t be able to connect. You can try from home network and let me know if you face any issues.

Kanika

Thenks for helping me…
First it gave me warning shell and server versions do not match.
Then it connects…

Hi Kanika,

I am able to connect at home in my personal laptop. Seems like some network blocking issues at office. So I am not able to connect.

Thanks for your help.

Bhaskar

1 Like

Hi,

I type in 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

and am getting “Error parsing command line: unrecognised option ‘–ssl’”

I downloaded version 4.0.3 and the Mongo shell version is 3.2.1.

Thanks.

Hi alice_ching,

Are you using Mongo Community Version by any chance? If yes, please install the evaluation version for the enterprise edition.

Here is the link: https://www.mongodb.com/download-center?initial=true#enterprise

Kanika

Hi,
I’m getting an error like “Shell and Server Versions do not match”.Help me to fix this

HI Kanika,

I am using the evaluation version of the enterprise edition.

Tried it a couple of times but still received the error of unrecognised option . --ssl

Thanks.

Not sure if this helps, but I tried
ping cluster0-shard-00-00-jxeqq.mongodb.net and it connects.

But when I am in the bin folder and type “mongo” it says:

MongoDB shell version: 3.2.1

connecting to: test

2018-10-19T14:13:37.945-0700 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused

2018-10-19T14:13:37.946-0700 E QUERY [thread1] Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed :

connect@src/mongo/shell/mongo.js:224:14

@(connect):1:6

exception: connect failed

Any reason why connection would fail? this is using enterprise version.

Thanks.

connecting to: test

2018-10-19T14:13:37.945-0700 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused

2018-10-19T14:13:37.946-0700 E QUERY [thread1] Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed :

connect@src/mongo/shell/mongo.js:224:14

@(connect):1:6

exception: connect failed

Still getting the same issue even after trying from home. Even the compass is not working which was working fine last week.

Hi [Jitender_44805]

This is what worked for me :slight_smile:

once you see the error, hit exit

Then type mongo --nodb
Then you should see something like this-MongoDB shell version v3.4.0
After this message, type exit again
Then you will see bye in the terminal
Then type in this 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

And it should work for sure.

2 Likes