Install Mongo DB In Windows

In this article, we will learn how to install mongo db in windows. If you want to learn what ss Mongo db and difference between SQL and Mongo DB, then please read my previous blog from here.

Now, we will procced to install mongo db in our windows. Please follow below steps.

Step 1:

Please download community version (in .msi) from mongo db downloads.

Step 2:

Navigate to the folder where above file was downloaded. Right click on the file and click on Install.

Step 3:

Click next and choose complete setup type here.

Step 4:

Copy Data Directory path and click on Next. Then click on Install.

Step 5:

That’s it! You have successfully installed mongo db. To verify that navigate to the path that we have copied on above step. i.e C:\Program Files\MongoDB\Server\4.4\bin

Open Command Prompt and run this command.

"C:\Program Files\MongoDB\Server\4.4\bin\mongod.exe" --version

You can check that we have installed mongo v4.

Step 6:

To query in mongo, Please run this command.

"C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe" --version

It will open a mongo shell. To retrieve a name of the database, use this command.

> show dbs

Step 7:

It is a headache that to open a mongo shell, every time we have to execute this log command. To solve this problem we can set Environment Variable.

Open Edit the system environment variable from control panel.

Click on Environment Variable button.

Now, select path from the upmost section and click on Edit.

Add a new path that we have copied in step 4 and click ok.

Now open a command prompt again and just write mongo and hit enter.

Now you are able to open a mongo shell using just a mongo command.

 

Hope you guys found something useful. Please give your valuable feedback/comments/questions about this article. Please let me know how you like and understand this article and how I could improve it.

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories