Shell Connection to Atlas Cluster not workig

Hi folks,

I am new working with mongo db. I created a Cluster in Atlas and I was trying to connect to it via shell for windows, but I couldn´t. When trying to connect, the shell just displays ´…´.

Dont know what could be happening for it to fail.

Here I lend some details of what I have made that maybe could help understand the issue:

  1. I created an Atlas Cluster.
  2. I granted just my current ip adress to the cluster.
  3. I was able to connect to the cluster via the compass method, but I need the shell for editing in a more agile way.
  4. I was trying to connect with the link provided by Atlas for connecting with shell.

Shell Connect method

  1. This was the configuration of the mongo community edition I download and installed for using shell:

Mongo Communiy Edition Setup Chosen

  1. So when starting the mongo.exe, and try to connect to my cluster, It just stays like charging something but it never works at the end…

Connection stays in elipsis

This is the session information for my mongo db for windows after initiating:

May someone help me detect what I might be doing wrong?
Please Help.

Kind Regards,
Luis

Hey,

I’m just very novice to this, but I finally understand it and figure it out.

If your’e new to this just like me, add the directory of where the mongo server files are installed in your program files, to the advanced settings of your windows environment variables. Once that’s added, just copy and paste the link provided to connect to your cluster for shell in the cmd, don’t do anything else. (of course just change the db name to a valid one). Enter your passwrod, and that’s it, you´ll be in.

Thanks for reading this, hope it helps someone.

Regards from Costa Rica!

Good you were able to resolve it yorself and thanks for sharing the fix
Want to add few lines
Mongo and mongod commands should be run at os prompt
If your run these commands while already connected to mongo shell you will get syntax error or error like you got
3 dots(…) means command is not complete and it is waiting for more
In your case you somehow were at mongo prompt (“>” symbol) indicates mongo prompt in Windows

I could reproduce the error on Windows

Case 1:

mongo “mongodb+srv://sandbox.xyz.mongodb.net/test” -u m001-student
2020-12-14T20:28:03.360+0530 E QUERY [js] SyntaxError: missing ; before statement @(shell):1:6

Case 2:

mongo mongodb+srv://sandbox.muehb.mongodb.net/test -username m001-student

When i add -p and hit enter it gives syntax error

mongo mongodb+srv://sandbox.muehb.mongodb.net/test -username m001-student
… -p
2020-12-14T20:30:53.706+0530 E QUERY [js] SyntaxError: missing ; before statement @(shell):1:6

So correct way to run

C:\Users>mongo mongodb+srv://sandbox.xyz.mongodb.net/test -username m001-student on Windows

or $ prompt on Unix systems

1 Like