JIYIK CN >

Current Location:Home > Learning > DATABASE > MongoDB >

Starting MongoDB from Windows

Author:JIYIK Last Updated:2025/04/28 Views:

Use this MongoDB tutorial article to install and start MongoDB 5.0 Community Edition on Windows using the default installation wizard.

This article uses the default MSI installation process to install MongoDB on Windows. However, system administrators can use the msiexec.exe utility to leverage automation to deploy MongoDB in an unattended manner.

The MongoDB server does not include the MongoDB Shell (mongosh). To download and install mongosh, you must first follow the installation instructions for mongosh.


MongoDB Platform Support

MongoDB 5.0 Community Edition supports only the following 64-bit versions of Windows on the x86_64 architecture:

  1. Windows Server 2019
  2. Windows 10 / Windows Server 2016

MongoDB supports only 64-bit versions of these systems. On Windows hosts running Hyper-V, Oracle provides experimental support for VirtualBox.

On the other hand, Microsoft does not support VirtualBox on Hyper-V. If you want to install MongoDB on Windows using VirtualBox, disable Hyper-V.


Download MongoDB Installation

Follow these instructions to install MongoDB Community Edition using the MongoDB Installer Wizard. The installation process installs the MongoDB binaries and the default configuration file install directory>binmongod.cfg.

➤ MongoDB Download Center

  1. In the Version drop-down list, select the MongoDB version you want to download.
  2. In the Platform drop-down list, select Windows.
  3. In the Package drop-down list, select msi.
  4. Click Download.

Installing mongodb in Windows


Run the MongoDB installer

You can run it from Windows Explorer/File Explorer.

  1. Go to the specific directory where you downloaded the MongoDB installer (.msi file). By default, this is your download directory.
  2. Double-click the .msi file in the directory.

This wizard walks you through the installation of MongoDB and MongoDB Compass.


Select the type of setup

You can use the Complete setup or Custom setup options. MongoDB and MongoDB Tools are installed to the default location using the Complete installation option.

You can use the Custom installation options to define which executable files are installed and where they are installed.


Service Configuration

Starting with MongoDB 4.0, you can install binaries or set up MongoDB as a Windows service during installation. MongoDB Service MongoDB is a database management system.

Use the following steps to install MongoDB and configure it as a Windows service. Starting with MongoDB 4.0, you can set up and start MongoDB as a Windows service during the installation process, and the MongoDB service will be started after the installation is complete.

MongoDB service customization

  1. Choose to install MongoDB as a service.
  2. choose:

Run the service as the Network Service user (default). This is the Windows user account that comes with the operating system.

or

As a local or domain user, start the service.

  1. Set the account domain to a period and the user account name and account password of an existing local user account.
  2. For an existing domain user, specify the user's account domain, account name, and account password.
  3. The details of a directory in MongoDB are:
  • Service Name: Enter a name for the service. MongoDB is the default name. If you already have a service with the name provided, you must specify a new name.
  • Data Directory: Use the -dbpath option to specify the data directory. If the directory does not exist, the installer will create it and provide directory access permissions to the service user.
  • Log Directory: This option specifies the log directory corresponding to the -logpath option. If the directory does not exist, the installer will create it and provide directory access permissions for the service user.

Installing MongoDB or mongosh on Windows

Check the box with Install MongoDB Compass Label to install MongoDB Compass. When ready, click on the Next button.

Installing MongoDB Compass is optional.

Install MongoDB Compass

The .msi installer does not include mongosh. You can install it from the Mongosh installer.

Installing mongosh on Windows

After successful installation, the MongoDB service starts. Use the installation directory>binmongod.cfg configuration file to configure the MongoDB instance.

If you only installed the executable and did not install MongoDB as a Windows service, you must manually start the MongoDB instance.

Starting with version 4.0, MongoDB can now be installed and configured as a Windows service. After successful installation, the MongoDB service is started.

Use the installation directory>binmongod.cfg configuration file to configure the MongoDB instance. During the installation process, add the path to the mongosh.exe binary to the PATH environment variable.

Then, to connect to MongoDB, open a new command interpreter and type mongosh.exe.


Start and stop the MongoDB service using the Windows Services console

Use the Services console to start the MongoDB service.

  1. In the Services console, find the MongoDB service.
  2. Right-click the MongoDB service and click Start.

Use the Services console to stop the MongoDB service.

  1. Find the MongoDB service in the Services console.
  2. Right-click (or Pause) to stop the MongoDB service.

Disable the MongoDB Community Edition Windows service

To uninstall the MongoDB service, stop it using the Services console. Then, open the Windows Command Prompt/Interpreter (cmd.exe) as an administrator and run the following command.

Order:

sc.exe delete MongoDB

Uninstall mongodb in command prompt

In this article, we introduced the download and installation of MongoDB and pointed out the steps to install MongoDB as a service.

For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.

Article URL:

Related Articles

Date comparison in MongoDB

Publish Date:2025/04/28 Views:169 Category:MongoDB

This MongoDB tutorial discusses the issue of returning Date-based queries. In addition, there is also a good tutorial on how to use Date Range queries in MongoDB. Using date ranges in MongoDB We will learn to write MongoDB date range querie

Find objects between two dates in MongoDB

Publish Date:2025/04/28 Views:94 Category:MongoDB

In this article, the problem of finding objects between two dates was briefly discussed. In addition, the operators $gte, $lte, $gt, and $lt used for this purpose were briefly explained in detail. Querying date ranges in MongoDB This sectio

Comparing Dates in MongoDB

Publish Date:2025/04/28 Views:115 Category:MongoDB

Date is a common field in most databases, and sometimes we need to find exact documents from a collection in MongoDB. For example, if we have a collection of orders, we might search for those documents before or after a specific date. In th

Convert string to date in MongoDB

Publish Date:2025/04/28 Views:162 Category:MongoDB

MongoDB is an excellent platform that is growing in popularity. Among the various features it offers, MongoDB also allows you to convert data from one type to another. This may seem like a complex function, but it is very simple to execute.

Building the MongoDB REST API

Publish Date:2025/04/28 Views:70 Category:MongoDB

MongoDB is a flexible and scalable document-oriented database system that is widely used for large-volume data storage. It uses documents and collections instead of the traditional rational database approach of using tables and rows. MongoD

Using ORM with MongoDB

Publish Date:2025/04/28 Views:117 Category:MongoDB

MongoDB introduces a NoSQL solution for data storage and management, consisting of documents represented in JSON style. Like other database systems, MongoDB can also use ORM. In this article, we will explain the concepts of ORM and general

Locking mechanism in MongoDB

Publish Date:2025/04/28 Views:95 Category:MongoDB

In database management systems, locking mechanisms ensure the consistency of the entire result. For example, if some writing process is in progress on the data, a read command cannot be executed at the same time. Database resources are lock

Unique Index in MongoDB

Publish Date:2025/04/28 Views:130 Category:MongoDB

In this article, you'll learn about unique indexes, including what they are and how to create them in MongoDB. Additionally, the process of making a user's email unique in MongoDB is briefly described. The contents of this article are as fo

Creating Indexes in MongoDB

Publish Date:2025/04/28 Views:178 Category:MongoDB

Indexes help resolve queries efficiently. Without indexes, MongoDB must iterate through every document in the collection to find the documents that match the query. It will waste time and require MongoDB to handle such information. Therefor

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial