How To Install MongoDB on Windows

Oct 21 20237 minutes
Video Tutorial

MongoDB is an excellent choice for a NoSQL database, with great features MongoDB also gives comfortability hosting like MongoDB atlas which is a cloud service from MongoDB company that we can use to develop our applications. We don’t have to worry about setting up MongoDB ourselves. However, if we want to set it up ourselves Mongodb provides a community edition server for a self-hosted solution with almost all the features of Mongodb atlas.

In this tutorial we’ll see how we can set up MongoDB on our Windows computer, but before starting the instructions you need to know about these tools related to the MongoDB environment.

  1. MongoDB community sever: Server for local setup of MongoDB
  2. MongoDB compass: A graphical user interface ( GUI ) for managing MongoDB visually.
  3. MongoSH: A command line tool for MongoDB

Well, see how to set up and use each of these tools on our Windows computer.

#Step 1: Download MongoDB

To install MongoDB we need to download MongoDB from the MongoDB website.

Just search for MongoDB community server on the internet and you will find the download page,

or just navigate to the www.mongodb.com and hover your cursor on products, and in the community edition section you will find the community server option, just click on that link and you will reach to the download page of MongoDB community server.

image from tutorend.com

Or you can click on this link to reach the download page.

Once you have reached the page and scroll a little bit down, you will find something like this.

image from tutorend.com

On the above page, you can see we can select a specific version of MongoDB we want to download and as we are doing it on Windows we have to select Windows in the platform.

We have two options for downloading MongoDB 1. MSI file, 2. Zip file Currently we are going to use MSI installer to install MongoDB.

After everything is selected correctly just click on the Download button and the download will be started, file size will be around 572 MB so you have to wait for some time based on your internet connection.

#Step 2: Installing MongoDB

Once the download has been completed we can initiate the installation process by double-clicking on the MSI file,

Step 3: After double-clicking the installer this window will appear just click on the Next.

image from tutorend.com

Step 4: Now accept the terms and conditions by checking the “✅ I accept the terms in the license Agreement” and click on Next to continue the process.

image from tutorend.com

Step 5: Now here you can choose the setup type either complete or custom.

  1. Complete: All the features will be installed.
  2. You can choose the features to install.

Here I am going with the complete setup as I might need all the features of Mongodb.

image from tutorend.com

Step 6: Here we are setting monodb as service, if you want your database to be available on your network then Select “Run service as Network service user” and click on Next.

If You Installed MongoDB as a Windows Service The MongoDB service starts upon successful installation.

image from tutorend.com

Step 7: Now if you also want to install MongoDB compass ( GUI for MongoDB ) then first check the option “✅ Install MongoDB compass” and click on Next.

image from tutorend.com

Step 8: Now just click on Install to start the installation process.

image from tutorend.com

Step 9: This may take some time so be patient.

image from tutorend.com

Step 10: After a few minutes this window will appear, which means MongoDB compass is being installed.

image from tutorend.com

Step 11: Shortly after the Mongodb compass is installed this window will appear, which is basically the MongoDB compass application.

image from tutorend.com

Step 12: While in the installation wizard, you will see these windows, and now that everything has been installed just click on Finish to finish the installation process.

image from tutorend.com

Now we have successfully installed MongoDB and MongoDB compass on our Windows computer,

These are the facts that you need to know after this

  1. While installing MongoDB installation wizard should add the MongoDB path in our Environment variables path if it is not then you can manually do it by copying the installation path of Mongodb and pasting it into the path in environment variables.
  2. As we MongoDB as a service in Step 6, it will automatically start the Mongod server when we start our computer.

We have installed mongodb compass to manipulate database visually but mongodb also has a command line tool for managing database ie. MongSH or MongoDB shell.

#MongoSH – MongoDB Shell

The MongoDB Shell, mongosh, is a JavaScript and Node.js REPL environment for interacting with MongoDB deployments in Atlas, locally, or on another remote host.

To install MongoSH follow steps on this offical guide.

#Conclusion

You have installed MongoDB, MongoSH for command-line and MongoDB compass for GUI access to the mongodb database now you can try to run some mongodb commands to test it out or build applicatons with it.

Happy coding 🙂