Installing MongoDB on Windows

By Ercan S. - 13/04/2025 - 0 comments

This guide outlines the steps to install MongoDB on a Windows environment.

1. Download MongoDB
Visit the official MongoDB website and download the Community Server version in ZIP format:
https://www.mongodb.com/try/download/community

2. Extract the ZIP File
Extract the downloaded ZIP file to a desired location, for example:

D:\Dev\mongodb-7.0.2

3. Create Necessary Directories
Within the extracted folder, create the following directories:

mkdir <<mongodb_path>>\conf
mkdir <<mongodb_path>>\data
mkdir <<mongodb_path>>\log

4. Create Configuration File
Inside the conf directory, create a file named mongo.config with the following content:

port=27017
dbpath=<<mongodb_path>>\data\db\
logpath=<<mongodb_path>>\log\mongo.log

For example:

port=27017
dbpath=D:\Dev\mongodb-7.0.2\data\db\
logpath=D:\Dev\mongodb-7.0.2\log\mongo.log

5. Run MongoDB
To start the MongoDB server, execute the following command in the command prompt:

.\mongod.exe -f "..\conf\mongo.config"

Tags: mongodb, windows