# How to Install MongoDB with mongosh on Windows (Manually)

Hello Devs! Here's a **clean step-by-step guide** you can use to install and run MongoDB with `mongosh` on Windows:

### **Step 1: Download MongoDB Server**

* Go to: [https://www.mongodb.com/try/download/community](https://www.mongodb.com/try/download/community)
    
* Select:
    
    * **Version:** 8.0 (latest stable)
        
    * **OS:** Windows
        
    * **Package:** `.msi (Installer)`
        
* Click **Download** and run the installer.
    

---

### **Step 2: Install MongoDB Server**

* Run the `.msi` file.
    
* During installation:
    
    * Select **Complete** setup.
        
    * ✔️ Enable “Install MongoDB as a Service” (recommended).
        
    * ✔️ Check “Install MongoDB Compass” if you need GUI (for beginners).
        

---

### **Step 3: Create Data Directory**

MongoDB stores database files in `C:\data\db` by default.

* Open PowerShell and run:
    
    ```powershell
    mkdir C:\data\db
    ```
    

---

### **Step 4: Start MongoDB Server**

* Open a new terminal and run:
    
    ```powershell
    mongod
    ```
    
* You’ll see logs like `Waiting for connections at 127.0.0.1:27017`
    

---

### **Step 5: Download mongosh (Mongo Shell)**

MongoDB no longer includes mongosh by default.

* Go to: [https://www.mongodb.com/try/download/shell](https://www.mongodb.com/try/download/shell)
    
* Select:
    
    * Version: `2.5.x` or latest
        
    * OS: `Windows 64-bit`
        
    * Package: `.zip archive`
        
* Download and extract the ZIP file.
    

---

### **Step 6: Move mongosh to Program Files**

* Create a folder:
    
    ```bash
    C:\Program Files\MongoDB\mongosh
    ```
    
* Move all extracted files (from `mongosh-2.5.3-win32-x64`) into this folder.
    

---

### **Step 7: Add MongoDB to System PATH**

So you can use `mongod` and `mongosh` from anywhere.

1. Press `Win + S`, search for **Environment Variables**, and open it.
    
2. Under **System Variables**, find `Path` → click **Edit**.
    
3. Click **New**, and add these:
    
    ```bash
    C:\Program Files\MongoDB\Server\8.0\bin
    C:\Program Files\MongoDB\mongosh\bin
    ```
    
4. Click OK → OK → OK to close all dialogs.
    

---

### **Step 8: Verify Installation**

Open a new **PowerShell** or **CMD** window and run:

```powershell
mongod --version
mongosh --version
```

Both should return version info.

---

### **Step 9: Connect to MongoDB**

* Run:
    
    ```powershell
    mongosh
    ```
    
* You’ll connect to `mongodb://127.0.0.1:27017` and enter the Mongo shell prompt:
    
    ```bash
    test>
    ```
    

You're now ready to use MongoDB!

> So! this was a step-by-step guide to installing and running MongoDB with mongosh on Windows. It involves downloading the MongoDB server and mongosh, installing them, setting up a data directory, and adding executables to the system PATH. Finally, you verify the installation and connect to MongoDB using mongosh.

---
