Here you will learn how to install MongoDB server, MongoDB Shell, and Compass on your local Windows machine.
Visit www.mongodb.com to download the MongoDB installer for your required platform.
MongoDB website
Here, we are going to install a free MongoDB database server on our local Windows machine. Therefore, click the Product -> Community Server menu, as shown below.
This will open a download page where you can select
the version, platform, and package options.
Here, we will download the latest MongoDB version, Windows platform, and msi file as a package, as below
. Download
Click the Download button to download the installer
file.
Once completely downloaded, click on the msi file to launch the installation wizard, as shown below.
MongoDB Installation Wizard Click Next to start the installation. MongoDB Installation Wizard
Select the “I accept the terms of the License Agreement” checkbox and click Next
.
Installation
Wizard Here, you will have two options
for
: Full and Custom. The full option will install all the features. The custom option allows you to select only the required functions.
You can select either of these two options. Here, we’ll select the custom option just to show you what things you’ll install. So, click on the Custom option that will take you to the next step, as below.
MongoDB
Installation Wizard
On the custom configuration page, expand the MongoDB node to see all the features that will be installed. You will install Server, Client, Router, and Miscellaneous Tools for the MongoDB database. It also shows the location where MongoDB will be installed. You can change it or keep the default location and click Next.
Click Next to configure
the MongoDB service, as shown below. Configure the MongoDB service
will be installed as a service on your local Windows machine. As you can see above, you have the option of running a service as a network service user or as a local or domain user. We will select the radio button “Run service as network service user”.
You can change the default name
of the service, but it is recommended to keep the default name “MongoDB” to easily identify it
.
The MongoDB database stores the data as BSON files on your local machine. You can change the default location where data files and log files will be stored. Here, we will keep the default routes and click on the Next button.
On the next page, select the “Install MongoDB Compass” check box and click Next. MongoDB Compass is a GUI tool for the MongoDB database where you can visually explore data, run queries, and optimize performance.
Installing MongoDB Compass
Then click the Install button to start the installation
.
It will take a few minutes to install. Once successfully installed, click the Finish button to close the wizard.
Installing MongoDB will also open MongoDB
Compass, as shown below
.
MongoDB Server
as a network service. To see this, open Services by searching for “service” in the Windows search box and click on the Services application, as shown below.
MongoDB
In the Services window, navigate to MongoDB Server, as shown below. You will find that it is already up and running.
MongoDB Service on Windows Now, the MongoDB
Server service is already running, you can
connect the MongoDB client to connect to this MongoDB server and run the commands. MongoDB Client MongoDB clients can be your application, MongoDB Shell, MongoDB
Compass, or anything you want to connect to and store data on the
server. Here,
we already installed two clients,
MongoDB Shell and MongoDB Compass.
Go to the path where MongoDB was installed. By default it is “C:\Program Files\MongoDB\Server\5.0\bin”, as shown below.
MongoDB
installation folder
Here you will find mongo.exe, which is MongoDB Shell. Click mongo.exe to start the client, as shown below.
You can run the commands here. For example, type “show dbs” and press Enter to display the database you already have, as shown below.
MongoDB Shell command
Therefore, you can install the MongoDB server, clients (MongoDB Shell and Compass), and other features.