Installing MongoDB Community Edition on Windows

MongoDB

MongoDB is a cross-platform document-oriented and NoSQL database. MongoDB Community Edition installation is a straightforward process for beginners.

In this guide, we’ll walk you through the steps to install and setup MongoDB Community Edition on the Microsoft Windows operating system.

What We Used

  • Microsoft Windows 7
  • MongoDB 3.2.9 binary file

1. Download MongoDB

Download the MongoDB latest stable release .msi binary file (This guide use version 3.2.9) from MongoDB download page for 32-bit or 64-bit Windows platform.

2. Install MongoDB

After download the MongoDB, double click the .msi file to start the installation process.

Click Next button to start the setup.

Start MongoDB 64-bit Setup Wizad

Check to accept the license agreement and click Next button.

Install MongoDB 64-bit License Agreement

Click Complete button to install all the program features.

Install Complete MongoDB 64-bit

Click Install button to start the installation.

Ready to Install MongoDB 64-bit

After finish the installation, click Finish button to complete the installation.

Completed MongoDB 64-bit Setup

This is the MongoDB installation directory.

MongoDB 64-bit Installation Directory

3. Add MongoDB to PATH

Open the Environment Variables dialog box, under System Variables, add MongoDB bin directory C:\Program Files\MongoDB\Server\3.2\bin to the Path variable.

Add MongoDB to Path Variable

4. Create Data Directory

Before start the MongoDB, it is required to create a data directory for MongoDB to store the database data. By default, MongoDB will store the data in the C:\data\db.

5. Start MongoDB

Execute the following command in the Command Prompt window:

mongod

If you see the following line in the Command Prompt window, you have successfully started the MongoDB server:

[initandlisten] waiting for connections on port 27017

By default, the MongoDB server will be listening to port 27017 for new connections.

6. Connect to MongoDB

After started the MongoDB, you can connect to MongoDB via the MongoDB shell. Open another Command Prompt window and execute the following command:

mongo

Now you are in the MongoDB shell and successfully connected to test database in MongoDB server.

C:\Users\chankok>mongo
MongoDB shell version: 3.2.9
connecting to: test
> _

Understand the Version Number

In MongoDB, an approach called the “odd-numbered versions for development releases” is used. By examining the second part of the version number, known as the release number, you can determine whether a version is stable or in development. If the second number is even, it represents a stable release. Conversely, if the second number is odd, it signifies an unstable or development release.

  • Even number – It is a stable or production version. For example, the version 3.2.9.
  • Odd number – It is an unstable or a development version. For example, the version 3.3.15.

Summary

Welcome to MongoDB world! You have successfully installed MongoDB Community Edition on Windows.

Other Resources