Skip to content
Guide · Install a database

How to Install MongoDB on Windows (Community Server + Compass)

MongoDB Community Server installs on Windows from an MSI wizard that can also set MongoDB up as a Windows service and install MongoDB Compass, the graphical client. One thing catches most beginners: the MongoDB Shell, mongosh, is not included and must be installed separately. This guide follows MongoDB's documented wizard for MongoDB 9.0, then covers mongosh, Compass, a first database and collection, and the problems people hit most often.

Steps checked 8 October 2026 against the official documentation for each product. Versions covered: MongoDB Community Server 9.0 (patch release 9.0.2, 28 September 2026), MongoDB Compass and MongoDB Shell (mongosh) current releases. Next review due April 2027. Installers, versions and download pages change; follow the official page if a step differs.
Short answer
  • Download the Community Server MSI from the MongoDB Download Center (Version, Platform Windows, Package msi). MongoDB 9.0 supports 64-bit Windows 11 and Windows Server 2022 on x86_64.
  • The wizard offers Complete or Custom setup, installs MongoDB as a Windows service named MongoDB (running as Network Service by default) and can install MongoDB Compass.
  • mongosh is not installed with the server: download its own MSI, make sure it is on your PATH, then run mongosh to connect to localhost on port 27017.
  • MongoDB creates a database and a collection the first time you store data in them, so use myNewDB followed by an insertOne() call is enough to create both.
  • By default the server only listens on 127.0.0.1, and MongoDB is not supported on Windows Subsystem for Linux (WSL).
How we know: Research-based: download options, wizard steps, defaults and commands were checked against the MongoDB Manual (Install MongoDB Community on Windows, MongoDB 9.0 release notes, databases and collections), the MongoDB Shell and MongoDB Compass documentation and the MongoDB Download Center on 8 October 2026. We have not installed MongoDB for this guide and no screenshots are shown; option names are the ones MongoDB documents.

MongoDB download: what to get from the Download Center

Installing MongoDB on Windows starts at the MongoDB Download Center, mongodb.com/try/download/community, under MongoDB Community Server. The Community edition is the free, self-managed server; MongoDB Atlas is MongoDB's managed cloud service and has nothing to download (see MongoDB Atlas pricing).

The MongoDB release notes list 9.0 as the current stable release series, with patch release 9.0.2 dated 28 September 2026, and advise always installing the latest stable version. The Windows installation tutorial lists the supported platforms for MongoDB 9.0 Community Edition as 64-bit Windows 11 and Windows Server 2022 on x86_64. Earlier Windows versions are not on that list, so check the platform table for the version you choose.

MongoDB components on Windows and where each comes from
ComponentWhat it isHow to get it
MongoDB Community ServerThe database server (mongod.exe)Download Center: Version, Platform Windows, Package msi
MongoDB CompassGraphical clientOption in the server wizard, or its own installer from the Compass download page
MongoDB Shell (mongosh)Command line shellSeparate MSI or zip from the MongoDB Shell download page
MongoDB Database ToolsImport, export and backup utilitiesSeparate download in the Download Center

Install MongoDB Community Server with the MSI wizard

MongoDB's Windows tutorial documents these steps for the default installation wizard:

  1. In the Download Center, choose the version in the Version dropdown, Windows in Platform and msi in Package, then click Download.
  2. Open your Downloads folder and double-click the .msi file.
  3. Choose Setup Type: Complete (recommended for most users) installs MongoDB and its tools to the default location; Custom lets you choose the executables and the folder.
  4. Service Configuration: select Install MongoD as a Service. Keep Run the service as Network Service user (the default, a built-in Windows account) unless you need a specific local or domain user. The default Service Name is MongoDB; the Data Directory and Log Directory are created for you if they do not exist.
  5. Install MongoDB Compass is selected by default; leave it ticked if you want the graphical client.
  6. Click Install.

When you install it as a service, MongoDB starts as soon as installation succeeds. Its settings live in the configuration file <install directory>\bin\mongod.cfg; stop the service before editing it and start it again afterwards. To start or stop MongoDB later, open the Windows Services console, find the MongoDB service and choose Start or Stop.

MongoDB also documents unattended installs with msiexec.exe and a zip archive for manual setups. If you skip the service option, you must start mongod.exe yourself with a data directory:

Run MongoDB without the service: create the default data directory and start mongod (Administrator command prompt)
cd C:\
md "\data\db"
"C:\Program Files\MongoDB\Server\9.0\bin\mongod.exe" --dbpath="c:\data\db"

Install mongosh and connect

The Windows tutorial is explicit that the .msi installer does not include mongosh. Download the MongoDB Shell from its own page in the Download Center; for Windows, choose the Windows 64-bit (10+) (MSI) platform. The shell supports Windows 10 and later and Windows Server 2016 and later, and connects to MongoDB 7.0 or newer.

MongoDB asks you to make sure the folder containing mongosh.exe is on your PATH. If you used the zip archive instead, add its folder under System variables, Path, Edit, New; running mongosh --help in a new prompt confirms the PATH works. Then connect. With no options, mongosh connects to a deployment on localhost on the default port 27017, and uses the test database unless you name another:

Connect to the local server (Windows command prompt)
mongosh
mongosh "mongodb://localhost:27017"

Optional: add the server binaries to PATH

If you also want to run mongod and the other server binaries without typing their full path, MongoDB suggests adding C:\Program Files\MongoDB\Server\9.0\bin to the system PATH.

MongoDB Compass download and first connection

If you left Compass ticked in the server wizard, it is already installed. Otherwise, the MongoDB Compass download page offers an .exe or .msi installer or a .zip archive. According to the Compass documentation, Compass needs a 64-bit Windows 10, Windows Server 2019, 2022 or 2025 system, MongoDB 7.0 or later, and .NET Framework 4.5 or later (the installer prompts you to install .NET if needed). Support for Windows 10 and Windows Server 2019 is deprecated and will be removed in a future Compass release.

After installation, Compass launches and asks you to configure privacy settings and update preferences. A connection to your local server uses the same connection string as mongosh, mongodb://localhost:27017. The download page also offers read-only and isolated editions of Compass; the full version is the one to use for learning. For alternatives, see the best MongoDB GUI tools and MongoDB Compass vs Studio 3T.

Create your first database and collection

MongoDB stores records as documents in collections, and a database holds one or more collections. There is no CREATE DATABASE step: according to the manual, MongoDB creates a database and a collection when you first store data in them. In mongosh, switch to a new database name and insert a document:

Create a database and collection by inserting the first document (mongosh)
use myNewDB
db.myNewCollection1.insertOne( { x: 1 } )
db.myNewCollection1.find()

What happens to _id

If a document has no _id field, MongoDB adds one with an ObjectId value, and insertOne() returns that value. Use insertMany() with an array to add several documents at once. To set options such as validation rules, create the collection explicitly with db.createCollection() instead.

Common problems after installing MongoDB on Windows

  • mongosh is not recognised. It was never installed (the server MSI does not include it) or its folder is not on PATH. Install the MongoDB Shell and open a new prompt.
  • Connection refused on port 27017. The MongoDB service is not running. Start it from the Services console, or start mongod.exe yourself if you installed without the service.
  • Other machines cannot connect. By default MongoDB binds to 127.0.0.1, so only clients on the same machine can connect. Change bindIp in mongod.cfg only after enabling authentication and following MongoDB's security checklist.
  • Windows Security Alert about mongod.exe. When you run mongod.exe manually, Windows Defender Firewall may ask about network access; MongoDB's documented response is to allow access on private networks.
  • Running MongoDB in WSL. MongoDB does not support Windows Subsystem for Linux; use a supported Linux system or the official container image instead.
  • Upgrading. The MSI upgrades automatically within a release series, but moving to a new release series requires a new installation.

CodeWithSQL's error library covers SQL Server error codes; for MongoDB, the manual is the reference.

MongoDB on macOS, Linux and Docker, and next steps

MongoDB documents a Homebrew tap for macOS and packages for supported Linux distributions, and it maintains an official Docker image, mongodb/mongodb-community-server. The related MongoDB in Docker guide covers containers in detail.

macOS with Homebrew (from MongoDB's macOS tutorial)
brew tap mongodb/brew
brew install mongodb-community@9.0
brew services start mongodb-community@9.0
Official MongoDB Community image (from MongoDB's Docker tutorial)
docker run --name mongodb -p 27017:27017 -d mongodb/mongodb-community-server:latest

Next steps

MongoDB is a document database, so most of what you learn about SQL applies to relational engines rather than to MongoDB queries. If you are deciding between them, read SQL vs NoSQL and MongoDB vs PostgreSQL. To learn SQL itself, start the SQL beginner course.

Frequently asked questions

Is MongoDB Community Server free?

Yes. MongoDB Community Edition is a free download from the MongoDB Download Center. MongoDB Enterprise Advanced and the Atlas cloud service are separate MongoDB products.

Does the MongoDB installer include mongosh?

No. The MongoDB documentation states that the MongoDB Shell is not installed with MongoDB Server and must be downloaded and installed separately.

Is there a MongoDB Atlas download?

There is no Atlas server to install: Atlas is MongoDB's fully managed cloud service. The Download Center offers the Atlas CLI for managing it from the command line, and you connect to Atlas deployments with Compass or mongosh.

How do I start the MongoDB service on Windows?

Open the Services console, locate the MongoDB service, right-click it and choose Start. If you installed MongoDB without the service option, run mongod.exe with --dbpath from an Administrator command prompt instead.

Which Windows versions does MongoDB 9.0 support?

The MongoDB 9.0 Windows tutorial lists 64-bit Windows 11 and Windows Server 2022 on x86_64. Compass and mongosh support a wider range, including Windows 10.

Sources

Checked 8 October 2026.

How we research guides: our editorial method. We link only to official downloads and never host installers.

Database installed?

Write your first queries with the free beginner course, then practise on real problems.