For enquiries call:

Phone

+1-469-442-0620

April flash sale-mobile

HomeBlogWeb DevelopmentHow to Install MongoDB in Windows 10? [Step-by-Step]

How to Install MongoDB in Windows 10? [Step-by-Step]

Published
29th Jan, 2024
Views
view count loader
Read it in
10 Mins
In this article
    How to Install MongoDB in Windows 10? [Step-by-Step]

    As an expert, I highly recommend MongoDB as an open-source and widely adopted document-oriented NoSQL database designed for efficiently storing large-scale data. Its support for JSON-like documents, ad hoc queries, indexing, and real-time aggregation makes it a popular choice in the database world. Installing and using MongoDB has become essential for web developers due to its growing popularity and the seamless manner in which it allows efficient data management. 

    In this article, I will tell you everything on how to download and install MongoDB in Windows 10. You can go through KnowledgeHut’s Web Application Development course to learn how to create a web application using the MongoDB database and get yourself the job of your dreams. This extensive guide will show you how to install MongoDB 6.0.1 Community Edition in Windows 10. So let us get started.

    MongoDB Version (6.0.1 Community Edition): Installation Method

    We will show you how to install MongoDB Community Edition on Windows 10 using the default method with the MSI installation wizard. 

    The msiexec.exe tool is useful for system administrators who wish to deploy MongoDB in an unattended fashion using automation. 

    Considerations

    Before you download and install MongoDB on Windows, you must consider some considerations.

    1. Install MongoDB Shell Separately

    MongoDB Shell (mongosh) does not come with the MongoDB Community Edition. You need to install it separately after successfully installing the MongoDB server on your windows 10 system.

    2. Platform Support

    MongoDB 6.0 Community Edition requires x86_64 architecture to function correctly.

    It supports 64-bit versions of the following Windows versions:

    • Windows Server 2019 
    • Windows 10 / Windows Server 2016 

    3. Virtualization

    Microsoft does not support VirtualBox on Hyper-V by default.

    If you want to install MongoDB on VirtualBox, then you need to disable Hyper-V in windows.

    Follow the following steps to disable Hyper-V in Windows 10: 

    • Go to Control Panel 
    • Select “Programs and Features” 
    • Select "Turn Windows features on or off" on the left side 
    • In the Windows Features menu, navigate to Hyper-V > Hyper-V Platform and uncheck the Hyper-V Hypervisor check box. 
    • Click OK to save changes 

    4. Production Notes 

    If you need to optimize database performance further, you can read the MongoDB production notes and deploy the configuration recommendations. 

    Prerequisites 

    Before downloading and installing MongoDB, you must fulfill the minimum MongoDB system requirements to avoid any errors and poor performance.

    Given below are the hardware and software requirements for MongoDB: 

    1. Hardware Requirements

    For Intel x86_64 architecture, MongoDB requires: 

    • Sandy Bridge or later processor 
    • Tiger Lake, Celeron, or Pentium processor. 

     For AMD x86_64 architecture, MongoDB requires:

    • Bulldozer or later processor. 

    2. Software Requirements

    • Windows Server 2019 
    • Windows 10 / Windows Server 2016 

    How to Download MongoDB for Windows 10?

    Here's a step-by-step guide to download MongoDB for windows 10 64-bit msi installer file.

    Step 1: Go to the Official MongoDB website

    Step 2: Navigate to Products > Community Edition 

    Step 3: Select the appropriate installer file from the dropdown menus on the Community Edition page.

    • In the version dropdown, select the latest version, 6.0.1(current) 
    • In the Platform dropdown, select Windows 
    • In the Package dropdown, select msi 

    dotnettutorials

    Step 4: Click the green "Download" button. Wait for 2-5 minutes for the file to download. (Depending on your internet speed) 

    How to Install MongoDB on Windows 10 [Step-by-Step]?

    After the installer file has been downloaded, it's time to run the installer file. 

    Step: 1: Go to the downloaded directory in your system (by default, it should be in the `Downloads` directory). 

    Step 2: Double-click on the .msi file. It will open the MongoDB setup windows. 

    MongoDB setup window

    Step 3: It will open the MongoDB Community Edition installation wizard. This setup wizard guides you through the installation of MongoDB in your system. To continue the process, click "Next." 

    MongoDB setup end-user license

    Step 4: Read the End-User License Agreement, accept the terms and conditions, and then click the "Next" button to continue. 

    MongoDB setup options

    Step 5: Next, you can choose either the Complete setup or Custom setup type to proceed. But for a beginner, we'd recommend using the Complete setup option. It installs MongoDB in the default location. Select the Complete setup, and click "Next." 

    MongoDB setup configuration
     Step 6: Select the "Install MongoD as a Service" option on the next page. Keep all other parameters as default. Click on the "Next" button.

    MongoDB compass setup

    Step 7: In the next step, you will get an option to install MongoDB compass. Uncheck it if you don't want MongoDB compass to be installed on your device, and then click the "Next" button. 

    MongoDB installation

    Step 8: In the "Ready to install MongoDB" page, click the "Install" button, give administrator access, and wait for the installation to finish. Once installation is complete, you can click on the "Finish" button to finalize your installation. 

    How to Install mongosh MongoDB Shell in Windows 10?

    MongoDB installer does not include mongosh, which is a MongoDB Shell used for interacting with MongoDB deployments. You need to install it separately.

    Here's a step-by-step guide to installing it: 

    Step 1: Open the MongoDB Download Center from this link 

    mongoose download center

    Step 2: Select Windows 64-bit (8.1+) (MSI) in the Platform dropdown menu 

    Step 3: Click on the Download button, and wait for the download. 

    Step 4: Go to the download directory, and double-click the installer file. 

    Step 5: Follow the installation prompts to install mongosh 

    Set up Environment Variable

    Before you can run the MongoDB server, you have to add the MongoDB path as an environment variable.

    Step 1: Go to the MongoDB installation directory in the “C Drive." Navigate to Server > 6.0 > bin folder. Copy the path. It will look like this:

    C:\Program Files\MongoDB\Server\6.0\bin 

    MongoDB copy bin path

    Step 2: Go to Windows Search for "Environment Variables" and open the option "Edit environment variables for your account" option.

    Open ‘Edit the system environment variables’ in Windows 10

    Step 3: Click on the "Environment Variable.."

    Open environment variables

    Step 4: On the System variables, find the "Path" option. Double-click on it.

    Set environment variables for MongoDB

    Step 5: Click on "New" to set a new path variable.

    Set environment variables for MongoDB

    Step 6: Paste the copied path here, and press "OK." Now you can run the MongoDB local server from any path in the terminal of your computer. 

    How to Check If MongoDB is Installed?

    After you've added the environment variable in the system, you can run the `mongod –version`  command on the Command window to check if MongoDB is installed correctly. It should give a result like this: 

    C:\Users\Arnab\Desktop> mongod --version 
    db version v5.0.9 
    Build Info: { 
    "version": "5.0.9", 
    "gitVersion": "6f7dae919422dcd7f4892c10ff20cdc721ad00e6", 
    "modules": [], 
    "allocator": "system", 
    "environment": { 
    "distarch": "x86_64", 
    "target_arch": "x86_64" 
    } 
    } 

    How to Create a Demo Database on MongoDB?

    Now that you've successfully installed MongoDB and mongoose shell in your system, here's a step-by-step guide to creating a demo database to check if the database is appropriately working.

    Step 1: Open the command prompt on your desktop, and type `mongosh` to start the MongoDB server. The screen will look like this. 

    Start MongoDB local server

    Step 2: Type `show dbs` to see the existing databases.

    Show database

    Step 3: To create a new database, just type `use ` For example, `use Knowledgehut` and hit enter.

    Create new database

    Step 4: To create a collection, you can type the following command. `db.createCollection(“”)`. For example, we can create a collection of students by typing `db.createCollection(“students”)` 

    Create new collection

    Step 5: Then, you can insert new data by typing `db.students.insertOne({"name":" John", "title":" Doe"})`

    Add data to collection

    Step 6: Now you can type `show dbs` to see all the databases, including the new one you just created.

    Show database

    How to Uninstall MongoDB in Windows 10? 

    Here are the steps you need to follow to uninstall MongoDB from Windows 10: 

    Step 1: Go to the control panel. 

    Step 2: Then go to the Programs and Features section 

    How to Uninstall MongoDB in Windows 10

    Step 3: Select MongoDB from the list and double-click on it, and a prompt will appear asking you to confirm the uninstallation. 

    Step 4: Click OK and wait for the uninstallation. Your system will restart.

    How to Uninstall MongoDB in Windows 10

    With that, you have successfully uninstalled MongoDB from Windows 10. 

    Navigate to Programs and Features

    To verify whether you've successfully uninstalled MongoDB from your system, you can open the Command window and type the following command: `mongod –version`. If it shows that "mongod is not recognized as an internal or external command," you've successfully uninstalled MongoDB from your Windows 10 system.

    Conclusion 

    MongoDB has garnered quite a lot of attention among developers and designers across the globe, owing to its numerous advantages over other SQL-based databases. 

    Not to mention that it's extremely easy to install on your Windows 10 computer. 

    Just download the installation files, launch it accordingly and follow the steps mentioned in detail to install MongoDB on your Windows 10.

    If you want to learn more, go to KnowledgeHut’s Web Application Development course, and you’ll learn everything you need to know about using the MongoDB database to create cloud-based applications.

    Once done, test the newly installed application to check if it works appropriately as per your need. If not, make sure to follow the above-mentioned steps carefully to ensure that you've followed all the steps correctly. 

    Looking to level up your coding skills? Dive into the world of Python with our unique and engaging Python course. Unleash your creativity and problem-solving abilities with this versatile language. Join us now and unlock endless possibilities!

    Frequently Asked Questions (FAQs)

    1. How Do You Install MongoDB on Windows Using CMD?

    Here is a step-by-step guide to installing MongoDB on Windows using CMD: 

    • Step 1 Open Your Browser and navigate to MongoDB Download Center
    • Step 2: Select the appropriate installer file from the dropdown menus.
      • In the version dropdown, select the latest version, 6.0.1(current) 
      • In the Platform dropdown, select Windows 
      • In the Package dropdown, select MSI. 
    • Go to the Downloads folder, and open the Windows Command Interpreter. 
    • Here, run the following command: `msiexec.exe /l*v mdbinstall.log /qb /i mongodb-windows-x86_64-6.0.1-signed.msi`, and press enter.
    • This will install MongoDB in the default directory "C:\Program Files\MongoDB\Server\6.0\bin.” 

    2. Can You Install MongoDB on Windows? 

    You can easily install MongoDB on a Windows system by following our step-by-step guide. Just check the system requirements before installing it on Windows. 

    3. Can I Run MongoDB Locally? 

    If you install the MongoDB community edition in your system, you can run MongoDB locally. However, you must consider that you can access the database only on your local machine. It's not accessible via the internet.

    4. How Do I Start MongoDB in Windows Automatically? 

    When installing MongoDB on your Windows 10 machine, choose the option to install MongoDB as a service. This will run MongoDB automatically when your machine is booting up

    5. How To Check MongoDB Version in Windows? 

    Open your command prompt, and type the following command: `mongod –version`. It will show the MongoDB version installed on your machine.

    Profile

    Arnab Ghosh

    Author

    I'm a SaaS Content Manager and self-taught developer who is passionate about tech and marketing. And I mix them to market my products online

    Share This Article
    Ready to Master the Skills that Drive Your Career?

    Avail your free 1:1 mentorship session.

    Select
    Your Message (Optional)

    Upcoming Web Development Batches & Dates

    NameDateFeeKnow more
    Course advisor icon
    Course Advisor
    Whatsapp/Chat icon