software installation

How to Install MongoDB on Windows 11

Professional setup of MongoDB installation on Windows 11 in a modern workspace.
Installing MongoDB on Windows 11: A step-by-step guide.

7 min read • 1,538 words

How to Install MongoDB on Windows 11

In today’s data-driven world, knowing how to install MongoDB on Windows 11 is a valuable skill for developers and data enthusiasts alike. MongoDB is a popular NoSQL database that allows for flexible data storage and retrieval, making it essential for modern applications. This guide will walk you through the installation process, ensuring you have a smooth experience setting up this powerful database system on your Windows 11 machine.

Throughout this article, you will learn the step-by-step procedure to install MongoDB using the MSI installer, ensuring your system meets the minimum requirements for a successful installation. Additionally, you will discover how MongoDB operates as a Windows service by default, and how to utilize the MongoDB Compass GUI for easier database management. By the end of this guide, you’ll be equipped with the knowledge to effectively manage your databases using MongoDB.

Step-by-Step Tutorial

Screenshot of MongoDB download page on a Linux desktop with realistic lighting.
Step 1: Download MongoDB Installer.

Step 1: Download MongoDB Installer

To begin the installation of MongoDB on Windows 11, the first step is to download the MongoDB installer. Follow these detailed instructions to ensure a smooth download process:

  1. Visit the Official MongoDB Website: Open your preferred web browser and navigate to the official MongoDB download page by entering the URL: https://www.mongodb.com/try/download/community.
  2. Select the Version: Once on the download page, you will see various options for different operating systems. Make sure to select the version specifically designed for Windows. Look for the section labeled “Windows” and ensure that you choose the correct architecture, either x64 or x86, depending on your system.
  3. Choose the Package Type: After selecting the Windows version, you will be prompted to choose a package type. Opt for the MSI package, as it provides a straightforward installation process. This option is typically recommended for most users.
  4. Click the Download Button: Once you have selected the appropriate version and package type, click on the download button. This action will initiate the download of the MongoDB installer file, which will be named something like mongodb-win32-x86_64-.msi.

Before proceeding with the download, it is advisable to check the system requirements to ensure compatibility with your Windows 11 setup. Additionally, consider downloading the latest stable version to benefit from the most recent features and security updates. Always ensure that you are downloading the Community Server version suitable for Windows to avoid any issues during installation.

Screenshot of MongoDB installation wizard on a Linux desktop environment.
MongoDB installation wizard in a Linux terminal.

Step 2: Run the Installer

1. **Locate the Installer**: Open File Explorer and navigate to your Downloads folder. Here, you should find the MongoDB installer file, which is typically named something like `mongodb-windows-x86_64-.msi`.

2. **Initiate the Installation**: Double-click on the .msi file to launch the MongoDB installation wizard. If prompted by User Account Control (UAC), click “Yes” to allow the installer to make changes to your device. This step is crucial as it grants the necessary permissions for the installation process to proceed smoothly.

3. **Follow the Installation Wizard**: The installation wizard will guide you through the setup process. Click “Next” on the welcome screen to proceed. You will then be presented with the license agreement. Read through the terms, and if you agree, select the checkbox to accept the license, then click “Next” again.

4. **Choose Installation Type**: You will be prompted to select the type of installation. For most users, the “Complete” option is recommended as it installs all features. Select “Complete” and click “Next.”

5. **Select Installation Path**: The wizard will then ask you to choose the installation path. It is advisable to keep track of this path for future reference, especially if you need to configure or troubleshoot MongoDB later. You can either accept the default path or specify a new one.

6. **Finish Installation**: Finally, click “Install” to begin the installation process. Once the installation completes, click “Finish” to exit the wizard. You should now have MongoDB installed on your Windows 11 system without any errors.

Screenshot of MongoDB service configuration options on a Linux desktop.
Configuring MongoDB as a service on Linux.

Step 3: Configure MongoDB as a Service

Configuring MongoDB as a service on Windows 11 allows it to run in the background and start automatically with the operating system. Follow these detailed steps to set it up correctly:

1. **Start the Installation**: Begin the MongoDB installation process by running the downloaded installer. During the setup, you will reach a screen that prompts you to configure MongoDB as a Windows service.

2. **Select Service Configuration**: Ensure that the option to install MongoDB as a service is checked. This option is crucial for enabling MongoDB to start automatically when Windows boots.

3. **Choose Default Data Directory**: It is recommended to use the default data directory, which is typically located at `C:\Program Files\MongoDB\Server\\data`. If you have specific requirements, you can change this directory, but it is advisable to stick with the default unless necessary.

4. **Set Log Directory**: Specify the log directory, which is usually `C:\Program Files\MongoDB\Server\\log`. Ensure that this directory is accessible and that the user running the service has the necessary permissions.

5. **Service Name**: The default service name is “MongoDB”. It is best not to change this name unless absolutely necessary, as it can lead to confusion or issues with service management.

6. **Finish Installation**: Complete the installation process. MongoDB will now be configured to run as a service, allowing it to start automatically with Windows.

After following these steps, you can verify that the MongoDB service is running by executing the following command in the command prompt:

net start MongoDB

This command will start the MongoDB service if it is not already running.

Screenshot of Linux terminal showing data and log directories creation.
Creating data and log directories in Linux.

Step 4: Create Data and Log Directories

To successfully install MongoDB on Windows 11, you need to create specific directories for data and logs. Follow these detailed instructions to set up the required folders:

1. **Open File Explorer**: Start by clicking on the File Explorer icon located on your taskbar or pressing `Windows + E` on your keyboard.

2. **Navigate to the C Drive**: In the File Explorer, click on “This PC” and then double-click on the “C:” drive to open it.

3. **Create the Data Directory**:
– Right-click in an empty space within the C drive window.
– Select “New” and then click on “Folder.”
– Name the new folder `data`.
– Open the `data` folder by double-clicking it.
– Inside the `data` folder, right-click again, select “New,” and then “Folder.” Name this folder `db`.

4. **Create the Log Directory**:
– Go back to the C drive by clicking the back arrow in the File Explorer.
– Right-click in an empty space again, select “New,” and then “Folder.”
– Name this folder `log`.

5. **Verify Folder Creation**: Ensure that you see both `C:\data\db` and `C:\data\log` directories.

If you prefer to create these directories in a different location, remember to update the MongoDB service configuration accordingly. Always ensure you have the necessary permissions to create folders in the root directory to avoid any issues during installation.

Screenshot of Command Prompt executing MongoDB service start command on Linux.
Starting MongoDB service in Command Prompt.

Step 5: Start MongoDB Service

To successfully start the MongoDB service on your Windows 11 machine, follow these detailed sub-steps:

1. **Open Command Prompt as Administrator**:
– Click on the Start menu and type “cmd” or “Command Prompt” in the search bar.
– Right-click on the Command Prompt application and select “Run as administrator.” This step is crucial as administrative privileges are required to manage services.

2. **Start the MongoDB Service**:
– In the Command Prompt window, type the following command and press Enter:

net start MongoDB

– If the service starts successfully, you will see a message indicating that the MongoDB service has been started.

3. **Check the Status of the Service**:
– To confirm that the MongoDB service is running, you can check its status by entering the following command:

net status MongoDB

– This command will provide you with information regarding the current state of the MongoDB service.

4. **Troubleshooting**:
– If you encounter any issues while starting the service, ensure that the MongoDB installation path is correctly set in your system’s environment variables. Additionally, check the MongoDB log files for any error messages that may provide insight into the problem.

5. **Set Service to Start Automatically**:
– To ensure that MongoDB starts automatically with your system, you can configure it to do so. Open the Services application by typing “services.msc” in the Run dialog (Windows + R) and locate the MongoDB service. Right-click on it, select “Properties,” and set the Startup type to “Automatic.”

By following these steps, you will have successfully started the MongoDB service on your Windows 11 machine, allowing you to access and utilize MongoDB for your development needs.

Screenshot of MongoDB shell prompt on a Linux desktop verifying installation.
Verifying MongoDB installation in the terminal.

Step 6: Verify MongoDB Installation

To confirm that MongoDB has been installed successfully on your Windows 11 system, follow these detailed steps:

1. **Open Command Prompt**: Click on the Start menu, type “cmd” or “Command Prompt” in the search bar, and hit Enter. This will open a new Command Prompt window.

2. **Access the MongoDB Shell**: In the Command Prompt, type the following command and press Enter:

mongo

This command attempts to start the MongoDB shell.

3. **Check for Successful Launch**: If the installation was successful, you should see the MongoDB shell

Leave a comment

Your email address will not be published. Required fields are marked *