How to Install MongoDB on Windows [Step by Step Guide]

To install MongoDB on Windows, first, you will have to download the installation file from the official MongoDB website.

You should download the correct file for your operating system like 32 bit or 64 bit. If you are not sure about it, just use the below command to check your OS version.

Check OS Version

C:\>wmic os get osarchitecture

Depending on your OS version, select the download package from the drop down and download the MongoDB installation file which will be about 100 MB.

By default, it will be downloaded in the “downloads” folder on your system.

Install MongoDB on Windows

Locate the downloaded MSI file and simply double click it. You will have to follow few step to install it easily.

MongoDB Installation on Windows

Once you will complete the installation, you will have to do some basic setup to configure MongoDB.

MongoDB requires a data folder to store its files. The default location for the MongoDB data directory is c:\data\db. So you need to create this folder using the Command Prompt. Just create the below folder using the commands shown below-

C:\>md data
C:\md data\db

Create Directory for MongoDB

Now you will have to start the services to run MongoDB.

Once you will install MongoDB on Windows, you will find some files extracted and stored in the below folder of your system.

MongoDB Installation on WIndows

Folder: C:\Program Files\MongoDB\Server\3.2\bin

You will need the highlighted two files mongo.exe and mongod.exe to start the MongoDB on windows.

Start MongoDB

To start MongoDB, you will have to execute the following command.

C:\>"\Program Files\MongoDB\Server\3.2\bin\mongod.exe"

Start MongoDB

Here the system will ask you about the connection. Here do not make mongod.exe visible on public networks without running in “Secure Mode” with the auth setting. MongoDB is designed to be run in trusted environments, and the database does not enable “Secure Mode” by default.

So select the Home/Private mode for the connection here.

Note: Here you will be getting the last line something like “waiting for connections on port 27017”. Ignore that. Just open another command prompt and start with the next step.

Connect to MongoDB

To connect MongoDB through Mongo.exe, open another command prompt and execute the below command-

C:\>"\Program Files\MongoDB\Server\3.2\bin\mongo.exe"

Connect to MongoDB

With this, you have installed MongoDB successfully on your windows system!

DB Help in MongoDB

If you any help related to MongoDB just type in the command prompt and it will show you all the available commands.


MongoDB Help Command

Now you can simply do the operation you want to perform. No need to go to any shell.

For example, we want to create a database named “hdfstutorial”. Just use the below command and your database will be created.

Command: use hdfstutorial

Create Database in MongoDB

This was all about how to install MongoDB on Windows. I hope you got the exact steps to install MongoDB on Windows operating system.

Do try and let me know if you will face any issue. The same method is used to install MongoDB on windows 10 or any other windows OS.


Leave a Comment