22.1 C
Texas

How to install MongoDB in Windows 10

Hi. How are you? This time we are going to talk about MongoDB. It is an opensource NOSQL database based on documents, written in C++, scalable and high performance. MongoDB stores BSON data structures with a dynamic schema. Consequently, the integration of the data in certain applications is easier and faster. Well, let’s see how to install MongoDB on Windows 10.

Downloading the MongoDB binary for Windows.

The first thing we have to do is, go to the official MongoDB website. Go to the download section and select the MSI file, corresponding to Windows in its current version. At the time of publication of this post, the version is 4.2.1.

Downloading the MongoDB MSI file
Downloading the MongoDB MSI file

Once you have downloaded the file, please run it to start the installation. Press Next to start the installation

MongoDB Setup Wizard welcome screen
MongoDB Setup Wizard welcome screen

Then accept the license and click Next to continue

Accept the License terms
Accept the License terms
- Advertisement -

In the next screen select between a Custom or a complete installation. In this case, I select a full installation.

Choose installation type
Choose installation type

This next screen is very important since we are going to install MongoDB as a Windows service. In other words, always start with the system and be registered. Also, select the directory where the data will be stored. In addition, select the directory where the logs will be stored. Likewise, you can assign the name for the service. Please remember the installation path. You will probably need it later.

Installing MongoDB as a service
Installing MongoDB as a service

Next, the wizard will ask if you want to install MongoDB Compass. This is a graphical interface to manage the data. If you like it, check the box and click Next to continue.

Install MongoDB Compass
Install MongoDB Compass

Once you have selected all the installation options, press Install to start the process.

Setup ready to install the program
Setup ready to install the program

The wizard will start the database installation process.

Installing MongoDB
Installing MongoDB

After a few minutes, the process will be successfully completed.

MongoDB finally installed
MongoDB finally installed

MongoDB finally installed

If you installed MongoDB Compass Comunity, then you are ready to use the database. This will start automatically once the installation is finished. Press connect to start the database

Just press Connect
Just press Connect

Then create the database. Assign a name to the collection as well. Press create database to continue.

Creating a database
Creating a database

It is now correctly configured and ready to be used.

MongoDB Compass Community
MongoDB Compass Community

Using MongoDB on the terminal

It is also possible to use MongoDB through command. You have to make some preparations, but don’t worry, here we show you how to do it. The first thing we need to do is check if MongoDB was installed as a service, and it’s running. With this in mind please press the Win+R combination and in the box type services.msc

Run services.msc
Run services.msc

Next, place Mongo Server in the list of services. Please verify that it is Running and that its Startup Type is Automatic.

MongoDB service running
MongoDB service running

It then adds an environment variable to run the service on any Command Prompt. To find out how to do it, please check our post about Wget in Windows 10. Here I only show you the final result. Keep in mind that you have to write the installation path that you assigned previously.

Add environment variable to MongoDB
Add environment variable to MongoDB

To test the operation of MongoDB, please open a cmd and type Mongo.

MongoDB running in a Command Prompt
MongoDB running in a Command Prompt

Conclusion

Finally we have seen how to install MongoDB in Windows 10. The process has been detailed in a simple way. In addition, we have seen how to start the program in graphical mode and through commands as well. All right, that’s it for now. Greetings!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article