How to Download & Install MongoDB on Windows

How to Download & Install MongoDB on Windows

·

2 min read

In this article, let us know the steps to download and install MongoDB on Windows. So, we can use it for future reference.

Step 1 — Download the MongoDB MSI Installer Package

Head over to the MongoDB download center site and download the current version of MongoDB. Make sure you select MSI as the package you want to download.

Step 2 — Install MongoDB with the Installation Wizard

A. Make sure you are logged in as a user with Admin privileges. Then navigate to your downloads folder and double-click on the .msi package you just downloaded. This will launch the installation wizard.

Step 3: Click Next to start the installation.

Step 4: Accept the license agreement then click Next.

Step 5: Select the Complete setup.

Step 6: Select “Run service as Network Service user” and make a note of the data directory, we’ll need this later.

Step 7: We won’t need Mongo Compass, so deselect it and click Next

Step 8: Click Install to begin the installation.

Step 9: Hit Finish to complete installation. Now we go to the location where MongoDB was installed in step 5 in your system and copy the bin path:

Step 10: Now, to create an environment variable open system properties << Environment Variable << System variable << path << Edit Environment variable and paste the copied link to your environment system and click Ok:

Step 11:After setting the environment variable, we will run the MongoDB server, i.e. mongod. So, open the command prompt and run the following command:

mongod

When you run this command you will get an error i.e. C:/data/db/ not found.

Step 12: Open C drive and create a folder named “data” Inside this folder create another folder named “db”. After creating these folders. Again open the command prompt and run the following command:

mongod

Now, this time the MongoDB server(i.e., mongod) will run successfully.

Run mongo Shell

Step 13: Now we are going to connect our server (mongod) with the mongo shell. So, keep that Mongod window and open a new command prompt window and write mongo. Now, our mongo shell will successfully connect to the Mongod.

Important Point: Please do not close the mongod window if you close this window your server will stop working and it will not be able to connect with the mongo shell.

Save this article for future reference.

Thank you for reading the article. Please like, share and comment. it will encourage me to write more such articles. Do share your valuable suggestions, I appreciate your honest feedback!!!