Introduction to MongoDB

Share via:

Introduction to MongoDB

MongoDB is an open and free NoSQL database management system. It is a document oriented database, i.e. it will store all the data in semi-structured Binary JSON like documents.

Features of MongoDB

Document Object Data Model: MongoDB stores the data as Binary JSON documents, with this you can store the data in a minimal number of documents and not by breaking it into multiple relations like relational databases. This allows for the flexible and dynamic schemas.

Built in Aggregation Tools:This allows you to perform analysis on complex data. These tools provide a way to group, filter and transform data. It is similar to GROUP BY clause in SQL.

Horizontal Scalability: This is the process of increasing the capacity of a MongoDB deployment by adding more servers to it, rather than updating the existing server. In this way, we can store large amounts of data and handle more requests by distributing the load across the multiple servers. By this, we can increase the number of requests that can be handled simultaneously.

Replication and High Availability: High availability is the ability of a database deployment to continue providing access to data and operating on data even in the case of server failure or any other system disruptions.

By this, if one server goes down, you can get the data from the other server.

Replication is the way of maintaining multiple copies of data across multiple servers. This provides data redundancy, with this data availability will be increased.

Flexible and Dynamic Schema:The document-oriented data model allows flexible and dynamic schemas, which make it easy for developers to add or remove fields.

Secondary Indexing: It is a data structure that allows for faster query performance by indexing the required fields within a collection.

These are used to improve the performance of read operations. MongoDB supports different types of secondary indexes, i.e. single field index and compound field index. This allows MongoDB to quickly locate the relevant document, which is based on the secondary index.

Terminology in MongoDB

Database: It is a physical container for the collections.

Collections: A collection is a group of documents stored together that have a similar structure. It is similar to a table in RDBMS.

Each document in a collection can have a different structure and can contain different fields, but they must have a similar structure.

Document: It is similar to a row in RDBMS. Each document in a collection can have a different structure, because there are no schema requirements for the MongoDB database. The documents are stored in collections i.e. tables in RDBMS.

Languages supported by MongoDB:

MongoDB provides official driver support for all popular programming languages like c++, java, Python, Perl, Ruby, Scala, Go, Rust, Node.js etc.

Table for terminologies in MongoDB VS RDBMS

MongoDB RDBMS
Collection Table
Document Tuple/Row
Field column
Embedded Documents Joins
Primary key(provide a default id if not provide it is a 12 byte hexadecimal number) Primary key
Pros of MongoDB over RDBMS

1. Flexible and Dynamic schema

2. No complex joins

3. Distributed data

4. Large volume of data

5. Cloud native

Cons of MongoDB over RDBMS

1. Limited Query functionality

2. No support for joins

3. Limited support for complex Fractionation s

RDBMS VS MongoDB

MongoDB is fast as compared to RDBMS because of indexing and efficient storage techniques.

MongoDB allows users a highly flexible and scalable document structure.

Complex transactions are not supported in MongoDB because complex join operations are not available.

MongoDB doesn’t need any schema, whereas RDBMS must have a schema which specifies the number of tables and relation in between them.

SQL VS NoSQL
SQL NOSQL
These databases are not suited for hierarchical data storage. These databases are best suited for hierarchical data storage.
These databases have fixed or static or predefined schema They have dynamic schema
Vertically Scalable Horizontally scalable
These databases are best suited for complex queries These databases are not so good for complex queries
Follows ACID property Follows CAP (consistency, availability, partition tolerance)
Examples:MySQL, PostgreSQL, Oracle, MS-SQL Server, etc Examples:MongoDB, GraphQL, Cassandra, etc

Applications Of MongoDB

1. Social Media

2. Real time Analysis

3. Mobile and web Applications

4. Content management system

5. Gaming

 

Author    : Teja

LinkedIn : https://www.linkedin.com/in/teja-sai-nadh-reddy-tatireddy-048882201

Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates

KTExperts is always active on social media platforms.

Facebook  : https://www.facebook.com/ktexperts/
LinkedIn    : https://www.linkedin.com/company/ktexperts/
Twitter       : https://twitter.com/ktexpertsadmin
YouTube   :  https://www.youtube.com/c/ktexperts
Instagram  : https://www.instagram.com/knowledgesharingplatform

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

Add Comment