RDBMS vs MongoDB
Hello everyone, in this article we will learn the
difference between RDBMS (Relational Database Management System) vs MongoDB.
Let’s go.
Following are the difference between RDBMS
(Relational Database Management System) vs MongoDB
v RDBMS is a relational
database.
MongoDB is a non-relational database.
v In RDBMS row represents implicitly structured data in a
table.
In MongoDB, the
data is stored in documents.
v RDBMS is a table based. You
can store data using columns and rows it contains a table.
In MongoDB
Collection based and key-value pair. The collection contains documents known as
Fields.
v In RDBMS you need design table structure, relations after
that you can start writing code.
In MongoDB, you
can start without a design table structure. In development, you can modify your
objects at a lesser cost.
v RDBMS firstly required
normalized data.
MongoDB is flexible and it doesn’t need normalized data.
v RDBMS is supported to Structured
Query Language.
MongoDB also support JSON (JavaScript Object Notation).
v In RDBMS are known for enforcing data integrity.
In MongoDB, data
integrity is not an explicit requirement.
v In RDBMS emphasizes on ACID
(Atomicity, Consistency, Isolation, and Durability) properties.
In MongoDB
emphasizes on CAP (Consistency, Availability, and Partition tolerance) theorem.
v RDBMS is a Column based.
MongoDB is a Field-based.
v RDBMS is using Group by function.
MongoDB is using Aggregation.
v RDBMS is not suitable for hierarchical data storage.
MongoDB is best suitable for hierarchical data
storage.
v In RDBMS Primary Key using uniquely
identifies each record in the table.
In MongoDB
Primary key (default key_id provided by MongoDB itself).
v RDBMS supports to Foreign key constraint.
MongoDB does not support Foreign key constraint,
but if you need foreign key constraint then you have to handle foreign key
constraint in the code.
v RDBMS is support for Joins (you can join two or more tables).
MongoDB is not supported to Joins, but you can
change your document structure (keep in mind MongoDB has a maximum document
size of 16MB.).
v RDBMS supports triggers.
MongoDB does not support triggers.
v In RDBMS you can retrieve data from the
table then you write following query
SELECT
* FROM table_name;
In MongoDB
you can retrieve data from the table then you write following code
db.collection_name.find();
v In RDBMS if you want to insert data
into the table then you write following query
INSERT
INTO table_name (column_1, column_2, column_3, ….) VALUES (value_1, value_2,
value_3, ….)
In MongoDB,
if you want to insert data into the collection then you write following code
db.collection_name.insert
({
field_1:
value_1,
field_2:
value_2,
field_3: value_3
})
v RDBMS if you want to update your existing data then you write
following query:
UPDATE student
SET stud_remark = ‘Pass’
WHERE stud_mark > 35;
MongoDB if you want to update your existing data
then you write following code:
db.student.update
({ stud_mark: { $gt: 35 } },
{ $set:
{ stud_remark: ‘Pass’ } },
{ multi: true })
Terminology
& Concepts
Many terminology and
concepts in MySQL have near equivalents in MongoDB. Following are the common
concepts across MySQL and MongoDB.
MySQL MongoDB
Table Collection
Row Document
Column Field
Join’s Embedded documents
Group by Aggregation
Pipeline
Comments
Post a Comment