Cannot connect to M121 course Atlas Cluster

When I copy the connection link directly from lesson:

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

I get some syntax error as:

Can someone tell me what is wrong with that?

1 Like

are you running daemon mongod in another shell? you have to execute mongod , then open a new cmd window and connect to shell

How can I run mongod?

I got this in my folder:
image

And when I try to launch mongod.exe it seems like crashing, cause it immediately turns off, it’s even hard to catch it with screenshot.

1 Like

Step 1
Go to command ,Win+R -> cmd
Type mongod and press enter . Check if any error ,if not You are now connected to mongod .Don’t close this window

Step 2
Open a new command window
Go to command ,Win+R -> cmd
Paste the mongo script

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

press enter, Now you are cooected to mongo shell
MongoDB Enterprise Cluster0-shard-0:PRIMARY>
if you check the first command window you can see the connection is established in the port 27017

You are already at mongo prompt.(>) indicates you connected to mongodb.Most likely you issued just mongo command which connects you to default mongod
Please exit and run from os prompt

1 Like

I got an error:
image

Windows cannot find “mongod” file. Make sure that the name is correct and try again

How can I exit? From what to where?

run from os prompt

Run what?
OS prompt - you mean windows powershell ?

I’m sorry if I ask stupid questions, I don’t understand this.

You don’t have to run any mongod to connect to Class cluster
You are getting syntax error as you already at mongo prompt
just run exit at the (>) prompt and run the connect string from your Windows cmd prompt
C:\Users…>mongo "mongodb://cluster0-shard-00-00-jxeqq…

Okey, so I’m here :

Pressing down “enter” and it just shutting down mongo.exe application

Then im going here and paste the link from the lesson :

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

And then i get:

What am I doing wrong?
Am I misunderstanding something?

Did you update the bin path of mongodb in environment variable? Please double check the mongo exe file location , my case it is in C:\Program Files\MongoDB\Server\4.2\bin\ , copy this and update in environment variable path .Then try the mongo script as above, hope it will help.

What do you mean “did I update the bin path”?
In what environment variable? Where can I find it? Where am I supposed to update MongoDB path?

My mongo.exe location is:
C:\Program Files\MongoDB\Server\4.4\bin
I can copy it, and where you want me to update it?

You mean that I should navigate in Windows CMD to folder where I got mongo.exe and then run this script:

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

?

Setting the path and variables in Windows 10

  1. From the desktop, right-click the very bottom-left corner of the screen to get the Power User Task Menu.
  2. From the Power User Task Menu, click System .
  3. In the Settings window, scroll down to the Related settings section and click the System info link.
  4. In the System window, click the Advanced system settings link in the left navigation pane.
  5. In the System Properties window, click the Advanced tab, then click the Environment Variables button near the bottom of that tab.
  6. In the Environment Variables window (pictured below), highlight the Path variable in the System variables section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, copy your path and paste it here and try
1 Like

Are you sure this is the solution of this problem and every student before even starting 3rd lecture of Chapter 0 called “Introduction” get to this conclusion basing on this lecture two description:

What is going on here?

Please go through the Introduction chapter ,before connecting to the Atlas cluster , you have to install all necessary packages and system should be configured .Good luck

I think that I already got it installed if we are at this point.

As @Lifas_Kassim wrote, you have to set your path. This is true for mongo and for any other software that is command line oriented. Windows has to know where to find the command. For graphical application a short-cut is automatically created. That cannot be done with command line tools.

1 Like

Okey i followed these steps:

And now you want me to copy my MongoDB path just like this :
image

So now I got my MongoDB installed globally, right?

Now I go to my CMD, paste in link from lecture :

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

So, all i had to do was just to stop pasting this link to my mongo.exe, and instead of that use CMD, navigate to MongoDB bin path, and paste this lecture link into CMD?

1 Like

Yes that is right
Just paste the connect string at Windows cmd prompt

From your snapshot you are successfully connected to Class cluster