Install MongoDB Enterprise Edition on Windows
On this page
Use this tutorial to install MongoDB 3.6 Enterprise Edition on Windows using the default installation wizard.
MongoDB Enterprise Edition is available on select platforms and contains support for several features related to security and monitoring.
This tutorial installs MongoDB 3.6 Enterprise Edition. To install a different version of MongoDB Enterprise, use the version drop-down menu in the upper-left corner of this page to select the documentation for that version.
This tutorial installs MongoDB on Windows using the default installation wizard. Alternatively, you may chose to install MongoDB on Windows in an unattended fashion, using
msiexec.exe from the command line (
cmd.exe ). This is useful for system administrators who wish to deploy MongoDB using automation.
➤ See Install MongoDB Enterprise on Windows using msiexec.exe for instructions.
MongoDB 3.6 Enterprise Edition supports the following 64-bit versions of Windows on x86_64 architecture:
Windows 10 / Windows Server 2016
Windows 8.1 / Windows Server 2012 R2
Windows 8 / Windows Server 2012
Windows 7 / Windows Server 2008 R2
MongoDB only supports the 64-bit versions of these platforms.
See Supported Platforms for more information.
Before deploying MongoDB in a production environment, consider the Production Notes document which offers performance considerations and configuration recommendations for production MongoDB deployments.
Make certain that you set Windows Explorer to show file name extensions for all file types. This can prevent issues where the file type displayed to the user differs from the actual file type.
If Windows Explorer has known file extensions hidden, what may appear to be
mongod.cfg is actually
Every time this tutorial refers to the command line, you should use the Windows command interpreter (
cmd.exe ) with Administrative privileges. Not all commands work in Powershell.
cmd.exe with Administrative privileges:
Press the windows icon key.
Click on the Start windows icon icon at the left end of the taskbar.
cmd.exein the search box.
Press Ctrl + Shift + Enter .
This starts the Command Prompt as the Administrator user.
This tutorial uses the default MongoDB Enterprise Edition location of
C:\Program Files\MongoDB\Server\3.6\ .
If you have installed in an alternative directory, you must adjust the paths as appropriate.
Users on Windows versions previous to Windows 10 must install the following update before installing MongoDB:
Users on Windows 10, Server 2016 and Server 2019 do not need this update.
Follow these steps to install MongoDB Enterprise Edition using the Windows Installation wizard. The installation process installs both the MongoDB binaries as well as the default configuration file
<install directory>\bin\mongod.cfg .
Open a web browser and visit the MongoDB Download Center.
The Download Center should display MongoDB Enterprise Server tab. If not, select Server, then click the MongoDB Enterprise Server tab.
In the Version dropdown, select the version that corresponds to MongoDB Server 3.6. The download center always displays the latest available point version. For older point releases, click Archived releases in the right hand navigation box.
In the OS dropdown, verify that
Windows 64-bit X64is selected.
In the Package drop down, verify that
If you choose the Custom installation option, you may specify an installation directory. MongoDB has no other system dependencies. You can install and run MongoDB from any 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 directory:
cd C:\ md "\data\db"
To start MongoDB, invoke mongod.exe.
"C:\Program Files\MongoDB\Server\3.6\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
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\3.6\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.
To connect a mongo.exe shell to the MongoDB instance, open another Command Interpreter with Administrative privileges and run:
For more information on connecting a mongo.exe shell, such as to connect to a MongoDB instance running on a different host and/or port, see The mongo Shell. For information on CRUD (Create,Read,Update,Delete) operations, see MongoDB CRUD Operations.
You can set up the MongoDB server as a Windows Service that starts automatically at boot time.
If you have not created the data and log directories for your MongoDB server, you must create them before running MongoDB Enterprise Edition as a Windows service.
From the Command Interpreter, create the following directories:
cd C:\ md "\data\db" "\data\log"
Create a MongoDB configuration file:
systemLog: destination: "file" path: "c:\\data\\log\\mongod.log" storage: dbPath: "c:\\data\\db"
Invoke the following command in the Command Interpreter to create the service:
sc.exe create MongoDB binPath= "\"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe\" ^ --service --config=\"C:\Program Files\MongoDB\Server\3.6\mongod.cfg\"" DisplayName= "MongoDB" start= auto
sc.exe requires a space between “
= ” and the configuration values (i.e.
binPath= ) as well as using
\"" to escape a double-quoted string.
If successfully created, the following message is written to the log:
[SC] CreateService SUCCESS
Close all other command prompts, then invoke the following command:
net start MongoDB
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.
To connect to MongoDB through the mongo.exe shell, open another Command Interpreter.
To stop the MongoDB service, invoke the following command:
net stop MongoDB
To remove the MongoDB service, first stop the service and then run the following command:
sc.exe delete MongoDB
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.
This value can be configured either:
If you installed MongoDB with the Windows installer (
.msi ), that
.msi automatically upgrades within its release series (e.g. 3.6.1 to 3.6.2).
Upgrading a full release series (e.g. 3.6 to 4.0) requires a new installation.
All command-line examples in this tutorial are provided as absolute paths to the MongoDB binaries. You can add
C:\Program Files\MongoDB\Server\3.6\bin to your System
PATH and then omit the full path to the MongoDB binaries.