top of page
  • Writer's pictureCristian Duque

What Is MongoDB?

Updated: Oct 2, 2023




MongoDB is a cross-platform, open-source, and document-oriented NoSQL database. This technology was released in 2009 and it is the most widely used NoSQL database.


NoSQL stands for "Not-Only-SQL". MongoDB is categorized as a document database, along with other types of NoSQL databases such as key-value databases (Redis), column-oriented databases (Apache Cassandra), and graph databases (Neo4j).



MongoDB's architecture is based on three layers:

  • Database: "It is also called the physical container for data. Every database has its own set of files existing on the file system. In a single MongoDB server, there are multiple databases present." What is MongoDB? - Introduction to MongoDB Architecture & Features (mindmajix.com)

  • Collection: It stores multiple documents, and each document can have a different structure.

  • Document: It represents individual records within a collection. MongoDB stores this information in BSON (Binary JSON) format, which is a binary-encoded representation of JSON. BSON includes multiple types such as: Array, Date, Float and Object.



NoSQL databases, also known as non-relational databases, differ from the RDBMS (relational database management system) model in several ways:

  • RDBMS schema is fixed and cannot be easily changed, while MongoDB is schema-less, which stores data in flexible, JSON-like documents.

  • RDBMS is table-based with rows and columns, whereas MongoDB is document-based.

  • RDBMS allows JOIN operations to query data across tables and requires data to be normalised. Instead, MongoDB doesn't support joins and doesn't require normalization.

  • RBDMS is designed to be vertically scalable by adding more resources on a single server. MongoDB is designed to be horizontally scalable, increasing its performance by adding more servers.


MongoDB has diverse applications: Big Data, Artificial Intelligence, Mobile Apps, Real-Time Analytics, Internet Of Things, Gaming, Web applications, Serverless Development and much more.


What are the advantages of using MongoDB:

  • "MongoDB is a distributed database at its core, so high availability, horizontal scaling, and geographic distribution are built in and easy to use" What Is MongoDB? | MongoDB

  • It supports indexing for document fields which can improve query performance.

  • Data redundancy through replica sets to ensure high availability.

  • Provides ad-hoc and document-based queries for manipulating data.

  • Sharding allows data distribution across multiple servers or clusters which can handle high traffic and failure recovery.

  • Dynamic and flexible schema design to store documents.

  • "MongoDB supports multi-document ACID transactions for the use cases that require them." ACID Properties In DBMS Explained | MongoDB | MongoDB


And the disadvantages:

  • It can be challenging to work with complex document relationships that may require SQL joins.

  • Querying large data sets and using in-memory indexes for query performance can lead to high-memory usage.

  • MongoDB's default configuration prioritizes performance and availability but may not be suitable for applications that require strong data consistency.


Check out my video:



2 views

Comments


bottom of page