Have you always wanted to get started with creating an amazing application with its database management backed by MongoDB? Then, here’s your quick and easy guide to install and set up MongoDB on Windows 10. This guide shows you the easier way around and a step-by-step tutorial for the same.
MongoDB has quite a huge fanbase among developers today. It fits greatly Nodejs as well because of the high scalability and convenience it offers. It is hence popularly collectively used in the MEAN (MongoDB, Express, Angular, Nodejs) or MERN (MongoDB, Express, React, Nodejs) stack.
In this tutorial for beginners, I am going to show the easy way to install and set up MongoDB on Windows 10. I will be installing MongoDB via the Windows installation client (msi).
Before we dive into looking at the steps to install and set up MongoDB on Windows, let us understand in brief what is MongoDB.
What is MongoDB?
Being a document-oriented database management system, MongoDB enables developers to store gigantic amounts of data. This NoSQL type database or Not-only SQL database is efficient that does not store data inside tables but as documents inside collections.
MongoDB Inc is the brain behind the MongoDB database is developed and managed by MongoDB Inc. This database management system was first launched in February 2009 and is managed under SSPL (Server-Side Public License).
MongoDB has gained popularity worldwide because of its driver support for popular languages like Nodejs, PHP, Java, Go, .Net, C, C++, Python, Ruby Scala, C#, Perl, Swift, Motor, and Mongoid. It works great as a database management system for applications based on these languages.
Top firms like Facebook, Google, Adobe, Nokia, and many others have chosen MongoDB as their DBMS.
Let us now get started on learning how to install and set up MongoDB on Windows 10.
How to Install and Set up MongoDB on Windows 10 using Installer
Let us get started with our step-by-step guide to install and set up MongoDB on Windows using the installer. Please note that I am installing MongoDB version 4.0.0.
However, while you are following the tutorial, you might find a newer version available for download. It is recommended you install the latest stable version on MongoDB unless a different version is needed for any specific purpose.
Start following the steps below to install and set up MongoDB on Windows using installer or msi.
- Open your browser and go to the MongoDB official download page. You can even land at this page manually by clicking the “Try Free” button in green on the top-left corner of MongoDB’s homepage. You should look for it in the top navigation bar.
- Now, you should see a download page where MongoDB allows users to install different its services for different platforms.
- Under the “Choose which type of deployment is best for you” heading, select On-premises (MongoDB Locally).
- Scroll a bit further to see the different servers available for download. Select MongoDB Community Server to pull open the Available Downloads menu.
- Make sure the version is the quite latest and stable one. Select the platform as Windows and package as msi. Once you’re done, hit Download.
- Once your installer is downloaded, open it and click Next.
- Read the terms and conditions mentioned in the EULA (End-User License Agreement) and check the “I accept the terms in the License Agreement” box to accept it and click Next.
- Now, you are asked to choose the type of setup of MongoDB that you want. Click Custom here.
- Next, in the Custom Setup utility, choose where you want MongoDB to be installed on your PC and click Browse.
- Type C:\MongoDB\ in the folder name field and click OK. This will now install MongoDB in your C drive. You can provide a different path if you prefer.
- Now, check if everything looks fine and press Next.
- In the Service Configuration setting, uncheck the “Install MongoDB as a service” option and click Next. We are doing this because we want to install our database manually.
- Again, uncheck the “Install MongoDB Compass” option.
- Finally, click Finish.
Setting Up MongoDB Database and Mongod Server
Now that we have successfully installed MongoDB on our Windows machine, let us now set up our database and MongoDB server. Because this guide to install and set up MongoDB on Windows aims at providing easier methods, I will not be using the CLI for setup.
Follow these easy steps to set up MongoDB.
- Navigate to your C:\ drive by opening File Explorer.
- Create a new folder and name it data.
- Navigate into the data folder and create a new folder inside it named db.
- Now, open a new file in your code editor. You may even use a blank Notepad. Paste the below code and save it as a .bat file. I have named mine StartMongo.bat.
@echo off cd "C:\mongodb\bin" start mongod.exe timeout 4 start mongo.exe exit
You can save this file on your Desktop to easily access it. Simply double to start up the server!
This guide discusses the simplest way to install and set up MongoDB on Windows 10.