How to install MongoDB on Windows 10

How to install MongoDB on Windows 10

December 10, 2019

MongoDB is a popular NoSQL database that provides flexibility, scalability, and ease of use. In this blog post, we’ll walk through the step-by-step process of installing MongoDB on a Windows 10 machine.

Prerequisites

Before we begin, ensure that you have the following prerequisites:

  • Windows 10: Make sure you’re running Windows 10 or a compatible version.
  • Administrator Privileges: You’ll need administrative rights to install software on your system.

Step 1: Download MongoDB Community Edition

  1. Visit the MongoDB Download Center.
  2. Select the Windows 64-bit (8.1+) (MSI) option from the platform dropdown menu.
  3. Click the Download button and wait for the download to complete.

Step 2: Install MongoDB

  1. Locate the downloaded installer file (MSI) and double-click it.
  2. Follow the installation wizard instructions:
    • Accept the license agreement.
    • Choose the installation directory (you can keep the default).
    • Select the components you want to install (MongoDB Compass, MongoDB Server, and MongoDB Tools).
    • Click Install and wait for the installation to finish.

Step 3: Add MongoDB Bin Directory to System Path

After installation, add the MongoDB bin directory to your system’s PATH environment variable:

  • Open the System Properties window (you can search for it in the Start menu).
  • Go to the Advanced tab and click the Environment Variables button.
  • Under System variables, find the Path variable and click Edit.
  • Add the path to the MongoDB bin directory (e.g., C:\Program Files\MongoDB\Server\4.4\bin).
  • Click OK to save the changes.

Step 4: Create a Data Directory

Create a directory where MongoDB will store its data. For example, create a folder named data in the root of your C drive (e.g., C:\data).

Step 5: Start MongoDB

  1. Open the Command Prompt as an administrator.
  2. Navigate to the MongoDB bin folder using the cd command (e.g., cd C:\Program Files\MongoDB\Server\4.4\bin).
  3. Run the following command to start the MongoDB server:
    mongod.exe –dbpath C:\data

    Replace C:\data with the path to your data directory.

Step 6: Verify MongoDB Installation

  1. Open another Command Prompt window.
  2. Navigate to the MongoDB bin folder.
  3. Run the following command to connect to the MongoDB shell:
    mongo

    You should see the MongoDB shell prompt (>). Congratulations! MongoDB is installed and running.

Conclusion

In this blog post, we covered the installation steps for MongoDB on Windows 10. Now you’re ready to explore MongoDB and build powerful applications. Happy coding! 🚀

Leave A Comment

ZiniSoft

Hello! We are a group of skilled developers and programmers.

Hello! We are a group of skilled developers and programmers.

We have experience in working with different platforms, systems, and devices to create products that are compatible and accessible.