What is MongoDB?

MongoDB is a popular open-source, document-oriented NoSQL database management system. It is designed to store and manage large volumes of data in a flexible and scalable manner. MongoDB uses a flexible document data model, which means that data is stored in JSON-like documents with dynamic schemas, allowing for easy and efficient storage and retrieval of complex data structures.

Why use MongoDB?

There are four major reasons why MongoDB is used more often. They are:

1. Flexibility: MongoDB uses documents that can contain sub-documents in complex hierarchies making it expressive and flexible. MongoDB can map objects from any programming language, ensuring easy implementation and maintenance.

2. Flexible Query Model: The user can selectively index some parts of each document or a query based on regular expressions, ranges, or attribute values, and have as many properties per object as needed by the application layer.

3. Native Aggregation: Native aggregation allows users to extract and transform data from the database. The data can either be loaded into a new format or exported to other data sources.

4. Schema-less model: Applications get the power and responsibility to interpret different properties found in a collection’s documents.

To configure PostgreSQL, kindly click on the following link: Click Here

Start the mongo Shell and Connect to MongoDB

Once you have downloaded the mongo shell, you can use it to connect to your running MongoDB server.

To connect to your database node using Mongo shell


Enter the following command at a command prompt on your local or client desktop to connect to a MongoDB database.


mongosh --host <host> -u <User Name> -p --authenticationDatabase <Database Name>

After connection done with your MongoDB, you should see output similar to the following.