M121: Atlas Connection Issue

Hello All,

This might be silly question but do I need to paste below connection string it in regular Mac terminal and try connecting? or should I use one of the below executables (attached image)?.

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/aggregations?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl -u m121 -p aggregations --norc

When I run it on regular MAC terminal, I get “~bash: mongo command not found”.


What you tried is correct but it seems to be PATH issue
Did you add your mongodb/bin to your path?
Check our forum threads.
sudo nano /etc/paths–>add mongodb bin–>save
open new Mac session and try the mongo command again

Hello @Ramachandra_37567

Where am I suppose to add MongoDB/bin? to the 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/aggregations?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl -u m121 -p aggregations --norc”?.

When I try the nano command you mentioned, it asks for password- I am assuming this is my laptop password, I entered but nothing happens.

What needs to be entered here to connect to a cluster? Please help.

path is a system variable
After you updated did you check by cat /etc/paths or echo $PATH
You should have your mongodb bin full path
If you are unable to do this just cd to the dir where your mongodb executable resides
Then run mongo command(just a workaround not a convenient method)

For compass check this link

Connection string for aggregate database in compass

Thank you, I was able to connect to compass successfully.

Here is the path where I downloaded MongoDB

Should I move it to different location?.


I also get this when I click on Mongo Executable.


Have you updated your PATH?
Please show echo $PATH
In your snapshot the full path of mongodb/bin is clearly shown
Just add that in your /etc/paths and save the file

Also you don’t run mongo by pressing the mongo exec
The command you ran tries to connect to default mongod on port 27017.Since it is not up your command failed

While you are at bin run
mongo “mongodb+srv://…” whatever your connect string

Hope it clarifies

I added the full path to etc/paths and went to bin through terminal and entered the connection string you mentioned here Connection string for aggregate database in compass.

But its not giving me any answer?!?.

How do I open up Mongo Shell from here?

First you need to fix mongo: not found error
If you have updated the path why you are getting this error
Show the output of echo$PATH

If you have updated the path there is no need to be in bin directory
I just gave that as a workaround

The connect string you used is wrong.It is meant for Compass
For shell it is different and it is available in your own post above(the one ending with nosrc)
Please rectify your path issue and then try with correct string
It will work
Another thing to note is the shell in Macos zsh vs bash
Use correct shell as per your course instructions


Original download path - I renamed the folder to “mongo”

I restarted my machine now I am seeing this for echo $PATH


I was able to resolve It using this Bash: mongo: command not found - #2 by Ramachandra_37567

Thanks for your help @Ramachandra_37567

1 Like