Install MongoDB on Windows
While writing this article I used Windows 7 as my OS. But you can follow this tutorial for other versions of windows as well. If you face any issue just put a comment below. I will try my best to help you out.
To install MongoDB on your windows first you have to download MongoDB for the windows version you are using. If you do not know the Windows version, open command prompt (press Windows key + R and then type CMD and hit enter).
In the command prompt type
wmic os get osarchitecture and hit enter. You will get the windows version.
Mine is a 64 bit.
Also you can right click on computer and select properties.
If you are using a 32 bit OS, then you can use MongoDB database smaller than 2GB.
Now go to the official MongoDB download page: https://www.mongodb.org/downloads
You can see both with SSL (Secure Sockets Layer) Support and without SSL support. I downloaded without SSL support.
Now extract the zip file in any location you want. I extracted in my C drive. The folder name should be like ‘mongodb-win32-x86_64…’
Case 1: Create a data\db folder in your C drive.
Case 2: You can also create it in different location.
Inside the extracted folder there will be a bin folder. Next thing is open command prompt and navigate to the bin folder (To do this type this command CD in my case its
CD C:\ mongodb-win32-x86_64../bin)
If case 1 above just run the command
mongo.exe in the command prompt.
If case 2 run
mongod.exe --dbpath d:\data (assuming you created the data\db folder in D drive)
If everything is perfect, there should not be any error. Don’t close this command prompt window. Because this window is running the MongoDB server on your computer. Now open another command prompt and type
The MongoDB will open in the command prompt and you can write your commands/queries here.
Enjoy the new installed DB. For any questions please leave a comment.