Skip to content
Runbook

Install MongoDB on Windows

Document-oriented NoSQL database (BSON), designed for horizontal scalability and flexible schemas.

Databasenosqldocumentdatabasebson

Installation

Server · winget
winget install MongoDB.Server

Installs MongoDB as a Windows service started automatically. Alternative: choco install mongodb.

Shell (mongosh) · winget
winget install MongoDB.Shell

Verify the installation

Verify
sc query MongoDB

Service

Start
net start MongoDB
Stop
net stop MongoDB
Status
sc query MongoDB

Important files

TypePathDescription
configC:\Program Files\MongoDB\Server\8.0\bin\mongod.cfgServer configuration (YAML).
dataC:\Program Files\MongoDB\Server\8.0\datadbPath data directory.
logC:\Program Files\MongoDB\Server\8.0\log\mongod.logServer log.

Default ports

27017

Command-line tools

  • mongoshAdministration and query shell.
  • mongodumpBinary export of a database.
  • mongorestoreRestore of a binary dump.

Uninstall

Uninstall
winget uninstall MongoDB.Server

Good to know

  • The MSI installer registers a Windows service named "MongoDB", driven by net start / net stop.
  • The net start/stop commands require an administrator terminal.
  • The MSI/winget installer does not add C:\Program Files\MongoDB\Server\8.0\bin to the PATH: mongod and mongosh are not recognized until you add it. Prefer sc query MongoDB to verify the service, independent of the PATH.
  • The data and log paths above are the MSI wizard defaults. They are customizable; the source of truth remains mongod.cfg.
  • By default, mongod listens on 127.0.0.1 with no authentication. Never expose port 27017 on a public network without enabling authentication (security.authorization: enabled in mongod.cfg) and a firewall.

Installation on Windows

winget installs MongoDB and registers it as a Windows service started automatically (service name: MongoDB). Open a terminal as administrator for net start MongoDB / net stop MongoDB.

The mongosh shell is a separate package (MongoDB.Shell). Then connect with mongosh to localhost:27017.