How to Download and Install Mongo DB on Windows

Janith Senanayaka
3 min readMay 16, 2021

--

In this blog ,I hope to explain how to download MongoDB and how to setup it with your device, so lets take a quick start for it.

Initially, before discussing about MongoDB lets see,

what is MongoDB?

Mongo DB is a NoSQL archive database with scalability and flexibility, which means it stores data in JSON just like documents. It has a powerful query language.

lets see how to download MongoDB

a).

You can click here and download current version of MongoDB, Select the msi as package you want to download.

After clicking on that link you will be taken to the page as mentioned above.

b).

step 01

After a successful download, you can double clicked the icon and take step to install it your device

step 02

click next to start installation

step 03

Accept the terms in the License Agreement and click next.

step 04

Select the complete and click next

step 05

Select ‘Install MongoDB as a Service’ and choose ‘Run service as Network Service user’. The Data Directory is the location where MongoDB will be installed. Keep it as the default. Better not to change it. after that click next to continue installation.

step 06

Next click install

step 07

Click finish to complete installation

c).

Create the Data Folders to Store our Databases

Now we need to set up the data folder where Mongo DB stores our databases. So, create a new folder named data in the local disk © and create a new folder named db in this data folder.

Next, we need to create 2 shortcuts to access mongo.exe and mongod.exe directly from the terminal using keywords instead of always typing location.

Then follow the below steps.

Step 01

Open the command line and go to the root directory of the folder

Step 02

Create a new hidden file named bash_profile using the following command.

touch .bash_profile

Step 03

Open this file using the vim editor using the below command: vim .bash_profile and press i to insert.

Step 04

Next we need to assign the location of mongo.exe and mongod.exe to 2 variables. To do this, enter the following commands in the vim editor.

alias mongod = “/C/Program\ files/MongoDB/Server/4.2/bin/mongod.exe”
alias mongo = “/C/Program\ files/MongoDB/Server/4.2/bin/mongo.exe”

Note: You should mention the proper version you have installed when use the commands..

Step 5: Now press Esc and enter ‘:wq’ to save and exit the vim editor.

Step 6: Next we can check whether MongoDB has been set up properly by entering the following command in the terminal

mongo — version

Congratulations!!!! now you successfully setup MongoDB

--

--