Data Storage in MongoDB

5.1 Collections

A database can contain as many collections as it wishes, and MongoDB stores data inside collections.

As an example, a database might contain three collections a user’s collection, a blog post collection, and a comments collection. The user collection would hold user data and documents, the blog post collection would hold blog posts and documents, and the comments collection would hold documents related to comments. This would allow for the easy retrieval of all the documents from a single collection.

5.2 Documents

Documents themselves represent the individual records in a specific collection.

For example inside the blog posts collection we’d store a lot of blog post documents and each one represents a single blog post now the way that data is structured inside a document looks very much like a JSON object with key value pairs but actually it’s being stored as something called BSON which is just binary JSON.

MongoDB Architecture

MongoDB is a popular NoSQL document-oriented database management system, known for its flexibility, high performance, high availability, and multi-storage engines. The term NoSQL means non-relational. It means that MongoDB isn’t based on a table-like relational database structure. It is used by Adobe, Uber, IBM, and Google. In this article, we will delve into the MongoDB architecture, exploring its key components and how they work together.

Similar Reads

Key Features of MongoDB

Document-oriented Database...

MongoDB Vs RDBMS

...

MongoDB Architecture and its Components

MongoDB’s architecture design involves several important parts that work together to create a strong and flexible database system. these are the following MongoDB’s architecture...

1. Drivers & Storage Engine

MongoDB store the data on the server but that data we will try to retrieve from our application. So that time how the communication is happening between our application and MongoDB server....

2. Security

Authentication Authorization Encryption on data Hardening (Ensure only trusted hosts have access)...

3. MongoDB Server

It serves as the central element and is in charge of maintaining, storing, and retrieving data from the database through a number of interfaces. The system’s heart is the MongoDB server. Each mongod server instance is in charge of handling client requests, maintaining data storage, and performing database operations. Several mongod instances work together to form a cluster in a typical MongoDB setup....

4. MongoDB Shell

For dealing with MongoDB databases, MongoDB provides the MongoDB Shell command-line interface (CLI) tool. The ability to handle and query MongoDB data straight from the terminal is robust and flexible. After installing MongoDB, you may access the MongoDB Shell, often known as mongo. It interacts with the database using JavaScript-based syntax. Additionally, it has built-in help that shows details about possible commands and how to use them....

5. Data Storage in MongoDB

5.1 Collections...

6. Indexes

Indexes are data structures that make it simple to navigate across the collection’s data set. They help to execute queries and find documents that match the query criteria without a collection scan....

7. Replication

Within a MongoDB cluster, data replication entails keeping several copies of the same data on various servers or nodes. Enhancing data availability and dependability is the main objective of data replication. A replica may seamlessly replace a failing server in the cluster to maintain service continuity and data integrity....

8. Sharding

Sharding is basically horizontal scaling of databases as compared to the traditional vertical scaling of adding more CPUS and ram to the current system....

Conclusion

The architecture of MongoDB has been thoroughly examined in this extensive article, including its essential parts, data storage, replication, sharding, high availability, security, scalability, and performance optimization. MongoDB is a top choice for a wide range of applications, from small-scale initiatives to massive, data-intensive systems, due to its adaptable and potent design. To fully utilize MongoDB and create reliable, scalable, and secure solutions, developers and administrators must have a thorough understanding of the database’s architecture....