MongoDB: How to Install Mongo Shell?

MongoDB: How to Install Mongo Shell?

·

2 min read

To interact with MongoDB and perform administrative tasks, developers often use the MongoDB Shell, a powerful command-line tool. In this blog post, we will guide you through the process of installing the MongoDB Shell on Windows, step by step.

Prerequisites

Before installing the MongoDB Shell, make sure you have the following prerequisites:

  1. Windows operating system (compatible versions include Windows 7, Windows Server 2008 R2, or later)

  2. Administrative access to your machine

Step 1: Download the MongoDB Shell Installer

To begin the installation process, follow these steps:

  1. Open a web browser and navigate to the MongoDB download page: mongodb.com/try/download/shell.

  2. Select "Windows 64-bit (8.1+) (MSI)" option

  3. Scroll a bit down to the "Download" button then click on it.

Step 2: Run the Installer

Once the MongoDB Shell installer is downloaded, follow these steps to run it:

  1. Locate the downloaded installer file, which typically resides in your system's default download location.

  2. Double-click on the installer file to launch the MongoDB Shell Setup Wizard.

  3. The wizard will guide you through the installation process. Click "Next" to proceed.

  4. Choose the installation location. By default, it will be installed in the C:\Program Files\MongoDB\Server\<version> directory (for me it is C:\Program Files\MongoDB\Server\6.0). You can change the location if desired.

  5. Click "Install" to begin the installation process.

Step 3: Verify the Installation

After the installation is complete, it's important to verify that the MongoDB Shell is working correctly. Here's how you can do it:

  1. Open the Windows Command Prompt by pressing Win + R and typing "cmd" followed by pressing Enter.

  2. In the Command Prompt, type mongo or mongosh and press Enter.

  3. If the MongoDB Shell successfully launches, you will get a screen as the following

  4. You can now start interacting with the MongoDB Shell and execute various commands.