How to Download and Install Mongo DB on Windows
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
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.
After a successful download, you can double clicked the icon and take step to install it your device
click next to start installation
Accept the terms in the License Agreement and click next.
Select the complete and click next
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.
Next click install
Click finish to complete installation
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.
Open the command line and go to the root directory of the folder
Create a new hidden file named bash_profile using the following command.
Open this file using the vim editor using the below command: vim .bash_profile and press i to insert.
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