Cant connect to Atlas cluster from mongo shell

Hi ,

Need a help to know how to connect to atlas cluster form mongo shell

when I am trying to connect from my windows system using cmd getting
error The system cannot find the path specified. as shown in the attached screenshot.

Please help me to know where i am doing wrong.how to get that $prompt,is it linux?

Thanks,
Samita

Hi @Samita_65087,

So, you can launch the mongo command in two ways. But, first let’s see why you are not able to cd into this directory.

cd C:\Program Files\MongoDB\Server\4.0\bin\mongod

You are getting error because mongod is not a directory. It is an executable file so you cannot cd into it.

Please use this command and it will work for you.

cd C:\Program Files\MongoDB\Server\4.0\bin

Now once you are inside the bin directory, you can use the connection string provided in the lecture notes to achieve the same.

However, I would highly recommend you to set up the path in your environment variables so that you don’t have to cd into the bin directory every time you use any MongoDB commands.

Please refer this video lecture Lecture: Installing the mongo Shell (Windows) for setting up the path in the windows machine.

Yes, this prompt appears in linux and MAC devices. But you don’t have to worry about it, as you will be able to run all the commands in windows as well.

If you have any other issue, feel free to get back to us. Happy Learning :slight_smile:

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Thanks a lot @Shubham_13709 for your immediate response.

Able to connect to Atlas cluster now.