Content
• SQL Vs NoSQL
• MongoDB – Introduction
Reference: https://www.geeksforgeeks.org/mongodb-an-introduction/
SQL Vs NoSQL
SQL Vs NoSQL
MongoDB - Introduction
MongoDB, the most popular NoSQL database, is an open-source document-
oriented database.
MongoDB isn’t based on the table-like relational database structure but
provides an altogether different mechanism for storage and retrieval of
data.
This format
A simple of storage
MongoDB is called BSON (Binary JSON (JavaScript Object
document
Notation
Structure:- popular standard for data interchange on the web))
MongoDB - Introduction
A record in MongoDB is a document, which is a data structure composed
of field and value pairs.
MongoDB documents are similar to JSON objects.
The values of fields may include other documents, arrays, and arrays of
documents.
MongoDB - Introduction MongoDB - Features
•Document Oriented: MongoDB stores the main subject in the minimal
number of documents and not by breaking it up into multiple relational
structures like RDBMS.
• For example, it stores all the information of a computer in a single
document called Computer and not in distinct relational structures like
CPU, RAM, Hard disk, etc.
Indexing: MongoDB uses it to process huge volumes of data in very
less time.
•Scalability: MongoDB scales horizontally using sharing (partitioning
data across various servers).
Data is partitioned into data chunks distributed across many physical
servers.
MongoDB - Introduction MongoDB - Features
•Replication and High Availability:
• MongoDB increases the data availability with multiple copies of data
on different servers.
• By providing redundancy, it protects the database from hardware
failures.
• If one server goes down, the data can be retrieved easily from other
active servers which also had the data stored on them.
•Aggregation:
• Aggregation operations process data records and return the
computed results.
• It is similar to the GROUPBY clause in SQL.
Where do we use MongoDB?
MongoDB is preferred over RDBMS in the following scenarios:
• Big Data: If you have huge amount of data to be stored in tables,
think of MongoDB before RDBMS databases. MongoDB has built-in
solution for partitioning and sharing your database.
• Unstable Schema: Adding a new column in RDBMS is hard whereas
MongoDB is schema-less. Adding a new field does not effect old
documents and will be very easy.
• Distributed data Since multiple copies of data are stored across
different servers, recovery of data is instant and safe even if there is a
hardware failure.