Install MongoDB Community on Windows using the Zip File
On this page
Overview
Use this tutorial to install MongoDB Community on Windows by downloading and extracting the zip file.
MongoDB Version
This tutorial installs MongoDB 7.0 Community Edition. To install a different version of MongoDB Community, use the version drop-down menu in the upper-left corner of this page to select the documentation for that version.
Installation Method
This tutorial installs MongoDB on Windows by extracting from a zip file. You can also install MongoDB on Windows by these other methods:
Considerations
MongoDB Shell, mongosh
The MongoDB Shell (mongosh) is not installed with MongoDB Server. You need to follow the mongosh installation instructions to download and install mongosh separately.
Platform Support
MongoDB 7.0 Community Edition supports the following 64-bit versions of Windows on x86_64 architecture:
Windows Server 2022
Windows Server 2019
Windows 11
MongoDB only supports the 64-bit versions of these platforms.
For more information, see Platform Support.
Note
MongoDB is not supported on Windows Subsystem for Linux (WSL). To run MongoDB on Linux, use a supported Linux system.
Virtualization
Oracle offers experimental support for VirtualBox on Windows hosts where Hyper-V is running. However, Microsoft does not support VirtualBox on Hyper-V.
Disable Hyper-V if you want to install MongoDB on Windows using VirtualBox.
Production Notes
Before deploying MongoDB in a production environment, consider the Production Notes for Self-Managed Deployments document which offers performance considerations and configuration recommendations for production MongoDB deployments.
Full Time Diagnostic Data Capture
MongoDB logs diagnostic data to assist with troubleshooting. For detailed information, see Full Time Diagnostic Data Capture.
On Windows, to collect system data such as disk, cpu, and memory, FTDC requires Microsoft access permissions from the following groups:
Performance Monitor Users
Performance Log Users
If the user running mongod
and mongos
is not an administrator, add them to these groups to log
FTDC data. For more information, see the Microsoft documentation here.
Install MongoDB Community Edition
Procedure
Follow these steps to install MongoDB Community Edition from the zip file.
Create Configuration File (Optional).
You can create a configuration file to specify options for MongoDB. To do so,
create a file named mongod.cfg
in the \bin\
directory within the
directory where you extracted the MongoDB files
(<install directory>\bin\mongod.cfg
). For more information on creating a
config file, see Configuration File.
Create Required and Optional Directories.
MongoDB needs a data directory to store your data. By default, it uses
C:\data\db
, but you may specify a different location in your config file. You can create the data directory using the Windows Command Prompt:mkdir c:\data\db If you specified a log path in the configuration file, create the log directory in the same way.
Start MongoDB Community Edition from the Command Interpreter
Open a Windows command prompt/interpreter (cmd.exe
) as an Administrator.
Important
You must open the command interpreter as an Administrator.
Create database directory.
Create the data directory where MongoDB stores data.
MongoDB's default data directory path is the absolute path
\data\db
on the drive from which you start MongoDB.
From the Command Interpreter, create the data directories:
cd C:\ md "\data\db"
Start your MongoDB database.
To start MongoDB, run mongod.exe
.
"C:\Program Files\MongoDB\Server\7.0\bin\mongod.exe" --dbpath="c:\data\db"
The --dbpath
option points to your
database directory.
If the MongoDB database server is running correctly, the Command Interpreter displays:
[initandlisten] waiting for connections
Important
Depending on the
Windows Defender Firewall
settings on your Windows host, Windows may display a
Security Alert dialog box about blocking
"some features" of C:\Program Files\MongoDB\Server\7.0\bin\mongod.exe
from communicating on networks. To remedy this issue:
Click Private Networks, such as my home or work network.
Click Allow access.
To learn more about security and MongoDB, see the Security Documentation.
Connect to MongoDB.
If you have not already done so, follow the mongosh installation instructions to download and install the MongoDB Shell (mongosh).
Be sure to add the path to your mongosh.exe
binary to your
PATH
environment variable during installation.
Open a new Command Interpreter and enter mongosh.exe
to connect to MongoDB.
For more information on connecting to mongod
using
mongosh.exe, such as connecting to a MongoDB instance
running on a different host and/or port, see
Connect to a Deployment.
For information on CRUD (Create, Read, Update, Delete) operations, see:
Run MongoDB Community Edition as a Windows Service
Start MongoDB Community Edition as a Windows Service
You can install and configure MongoDB as a Windows Service during the install, and the MongoDB service starts upon successful installation.
You can also manually manage the service from the command line. To
start the MongoDB service from the command line, open a Windows
command prompt/interpreter (cmd.exe
) as an Administrator, and
run the following command:
Verify that MongoDB has started successfully.
Check your MongoDB log file for the following line:
[initandlisten] waiting for connections on port 27017
You may see non-critical warnings in the process output. As long as you see this message in the MongoDB log, you can safely ignore these warnings during your initial evaluation of MongoDB.
Connect to the MongoDB server.
If you have not already done so, follow the mongosh installation instructions to download and install the MongoDB Shell (mongosh).
Be sure to add the path to your mongosh.exe
binary to your
PATH
environment variable during installation.
Open a new Command Interpreter and enter mongosh.exe
to connect to MongoDB.
Stop MongoDB Community Edition as a Windows Service
To stop/pause the MongoDB service, you can use the Services console:
From the Services console, locate the MongoDB service.
Right-click on the MongoDB service and click Stop (or Pause).
You can also manage the service from the command line. To stop the
MongoDB service from the command line, open a Windows command
prompt/interpreter (cmd.exe
) as an Administrator, and
run the following command:
net stop MongoDB
Remove MongoDB Community Edition as a Windows Service
To remove the MongoDB service, first use the Services console to stop
the service. Then open a Windows command prompt/interpreter (cmd.exe
) as an Administrator, and
run the following command:
sc.exe delete MongoDB
Additional Considerations
Localhost Binding by Default
By default, MongoDB launches with bindIp
set to
127.0.0.1
, which binds to the localhost network interface. This
means that the mongod.exe
can only accept connections from
clients that are running on the same machine. Remote clients will not be
able to connect to the mongod.exe
, and the mongod.exe
will
not be able to initialize a replica set unless this value is set
to a valid network interface which is accessible from the remote clients.
This value can be configured either:
Warning
Before you bind your instance to a publicly-accessible IP address, you must secure your cluster from unauthorized access. For a complete list of security recommendations, see Security Checklist for Self-Managed Deployments. At minimum, consider enabling authentication and hardening network infrastructure.
For more information on configuring bindIp
, see
IP Binding in Self-Managed Deployments.
Point Releases and .msi
If you installed MongoDB with the Windows installer (.msi
), the
.msi
automatically upgrades within the same release series (e.g. 7.2.1 to 7.2.2).
Upgrading a full release series (e.g. 6.0 to 7.0) requires a new installation.
Add MongoDB binaries to the System PATH
If you add C:\Program Files\MongoDB\Server\7.0\bin
to your
System PATH
, you can omit the full path to the MongoDB Server
binaries. You should also add the path to mongosh if you
have not already done so.