Install MongoDB Community Edition on Windows
On this page
Use this tutorial to install MongoDB 3.6 Community Edition on Windows using the default installation wizard.
This tutorial installs MongoDB 3.6 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.
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 Community on Windows using msiexec.exe for instructions.
MongoDB 3.6 Community 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.
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 Community Edition using the MongoDB Installer wizard. The installation process installs both the MongoDB binaries as well as the default configuration file
- Open a web browser and visit the MongoDB Download Center .
- The Download Center should display MongoDB Community Server tab. If not, select Server, then click the MongoDB Community 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 All version binaries in the right hand navigation box.
- In the OS dropdown, verify that
Windows 64-bit X64is selected.
- In the Package drop down, verify that
- Click Download.
Open a Windows command prompt/interpreter (
cmd.exe) as an Administrator.
You must open the command interpreter as an Administrator.
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:
To start MongoDB, invoke
--dbpath option points to your database directory.
If the MongoDB database server is running correctly, the Command Interpreter displays:
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.
Create a MongoDB configuration file:
MongoDB configuration files use the YAML file format. Per the YAML 1.2 specification , all indents must use spaces to maintain portability. To ensure no parsing errors, enclose all values in double quotation marks (
") and escape any backslash characters (
Invoke the following command in the Command Interpreter to create the service:
sc.exe requires a space between “
= ” and the configuration values (i.e.
binPath= `` ) as well as using `` "\" and
\"" to escape a double-quoted string.
If successfully created, the following message is written to the log: