What is MongoDB? How to Install it?

In this tutorial, we are going to introduce MongoDB, we will discuss what is MongoDB? And how we can install it. We will also discuss the importance of the MongoDB database.

What is MongoDB?

MongoDB is the document-oriented NoSQL database that’s mean MongoDB is not a relational database. We have discussed in detail about the difference between the relational and non-relational database and SQL and NoSQL database.

SQL database for Example MySQL Oracle has a relational database format like they have tables, columns, and rows which are related to each other. While in the NoSQL database the collection of data are not related to each other and they are non-relational.

The MongoDB is the open-source, schema-free database and it is based on binary JSON format which is also called BSON where B mean is binary while Son comes from JSON. MongoDB organizes data in the group of documents and these documents are structured in BSON language which is similar to JSON language. In MongoDB, we use references to link between the data documents rather than Join that we usually use to connect data in SQL database.


Now let see the difference between the MongoDB and the relational database management system (RDBMS).
As I have discussed that MongoDB uses the collection and inside collection, we have documents and fields, while in the Relational databases like MySQL and Oracle we use tables and inside the table, we use Rows and column. So that collection is like tables, documents are like rows and the field is like columns. Since the collection of NoSQL is schema-less than it is not that strict as compare to the Relational database.

Why Use MongoDB?

MongoDB is quick and easy to make iterations on your schema and when we compare MongoDB to other relational databases like MySQL and Oracle then the NoSQL is more scalable and provide better performance. According to MongoDB official site, MongoDB is object-oriented that why the administration of adding, reading, and writing looks very similar to JavaScript code. Mongo is simply designed to be extremely friendly to developers. The JSON representation makes it easy to parse through and understand the database contents. Mongo is widely used by many companies to deal with extensive data storage challenges.

How to install MongoDB:

Download MongoDB:

To download the MongoDB, go to the download page of the official MongoDB website. For the community server, scroll down to see the installation option for windows.

what is mongodb - Download MongoDB

Install MongoDB:

Now select the compatible version and then click on download button, it will download the msi installer. Once the download complete. Run the msi installer file and then give the permission to install it.

Setup MongoDB, how to setup

And then accept the license agreement.

how to setup MongoDB database

Now after accepting the license agreement, chose the complete setup on setup type screen and click next on the service configuration screen and then on the next screen click install.

Configuration setup MOngoDB

It will take your few seconds to install on your operating system.

Setting Up MongoDB:

Now let’s find out where the file of MongoDB went. Go and open your explorer and then go to C directory and in the folder “program file” locate the MongoDB folder. Inside MongoDB folder, you will find the server folder and inside that folder, you will find the MongoDB version which is 4.0 in my case. Now go ahead and open 4.0 version folder and inside version folder, you will see many files including bin folder. In bin folder, you will find the bunch of executable files but there are two things most important in here are Mongo and MongoD.

Now to run the MongoDB we need to add bin directory path in the system environmental variable. So open the environmental variable, edit the path and then add the new item and add the bin directory link in that PATH.

Environmental setup for mongoDB databse windows


Now the next thing we need to do is to create a data directory so go ahead and create a folder with name “data” in C directory and then inside “data” folder create another folder with name “db”.

Test MongoDB Setup:

Now open the command prompt and run the command “mongod” and press enter.

open MOngod in command prompt

You can notice that the MongoDB is now running. Now open another command prompt and type “mongo” in the command prompt and hit enter.

Run Mongo in windows command propmt

It will start the MongoDB in the shell or mongo console where you can perform the administrative operation and can add, delete and can perform update query. Now to make sure that everything working perfectly, let’s go ahead and insert a file into the database. Run the following command in your terminal and hit enter.

> db.users.insert({“site”:””})

How to insert data in database MongoDB

You can notice that it’s inserted one file. The MongoDB database is all about setup and running. If we want to check whether it is in the database or not, we will run the command “show collections”

MongoDB databse views Database

Now in the upcoming MongoDB tutorials, we will talk more about MongoDB queries.


In this mongodb tutorials, we have given the introduction MongoDB. We have also discussed how MongoDB NoSQL database is different from SQL database. We have seen that how we can install MongoDB. then, how we can run the MongoDB. In last we have run a simple query to test the setup.

Most Popular

To Top