Here we are going to learn How to Install and Set Up MongoDB on Windows 10. MongoDB is a cross-platform document-oriented database program and it is classified as a NoSQL database program. It was initially released on 11 February 2009 by MongoDB Inc.
First of all, let us download MongoDB, to download visit mongodb.com and click on “Try Free“. After that, it will redirect you to the MongoDB Download Center, just select the “Server” option and download the “MongoDB Community Server“.
How to Install MongoDB on Windows 10
Now after the download is complete follow these steps to install and setup MongoDB on windows 10. If you are using Windows 7, Windows 8.1 then also the steps are the same.
Step 1: Open the downloaded file and click on next, accept the license agreement.
Step 2: Now on the “Choose Setup Type” window select the “Complete” option and keep everything to default. It will create two directories, one is a data directory and another one is a log directory. After that click on next, check the box to install MongoDB Compass, and click on “Install” to install MongoDB on a Windows computer.
Step 3: After the installation is complete, it will open the MongoDB compass program. There just accept the license agreement and keep clicking on next till you see the “Get Start” option and click on “Start Using Compass“. Now close the MongoDB compass program.
Step 4: We had successfully installed MongoDB on our computer. Now we have to setup MongoDB.
How to Setup MongoDB on Windows 10
First of all, we have to set the path variable. For that, copy the path of MongoDB bin folder. Usually, you will get it on your C Drive > Program Files and look for MongoDB folder and open every folder unless you get the bin folder inside MongoDB folder.
Now Go to > Control Panel > System and Security > System > Advanced System Settings > Environment Variables > and under System Variables click on “Path” and click on Edit, New and paste the path of MongoDB bin folder.
Now we have to create one folder inside C Drive called “data” and inside that
Also Read: How to Create a New Folder in Windows 10
Everything is done, now its time to run Mongo shell. For that, open two command prompt windows.
Use C:\Program Files\MongoDB\Server\4.0\bin>mongod command in one window and
C:\Program Files\MongoDB\Server\4.0\bin>mongo in another windows. (Ever time you have to use these commands to use MongoDB on a windows computer)
Note:- mongod is MongoDB database server and mongo is MongoDB shell.