askantech-blog
MongoDB vs RDBMS

Deciding upon the right database has always been a bewilderment. While both Relational and non-relational databases are a viable option, certain key differences must be kept in mind to make the apt choice.

What is MongoDB?

MongoDB is a No SQL database. It is an open-source, cross-platform, document-oriented database written in C++ .
Since October 2018, MongoDB’s updates have been published under the Server Side Public License (SSPL) v1, and the database is free to use.

Some Key Features of MongoDB:

  • Load balancing : It has an automatic load balancing configuration because of data placed in shards.
  • Manageability: Doesn’t require a database administrator. User-friendly, can be used by both developers and administrators.
  • Secondary Indexing: Easy to index any property of an object stored in MongoDB even if it is nested. This makes it really easy to query from the database based on these secondary indexes.
  • Duplication of data: MongoDB can run over multiple servers. The data is duplicated to keep the system up and also keep its running condition in case of hardware failure.
  • Replication: MongoDB supports Master Slave replication. A master can perform Reads and Writes and a Slave copies data from the master and can only be used for reads or back up (not writes)
  • Multiple Servers: It can run over multiple servers.

What is RDBMS?

A relational database refers to a database that stores data in a structured format, using rows and columns.

Some Key Features of RDBMS:

  • Gives a high level of information security.
  • Supports virtual tables from where data can be retrieved by using sql queries.
  • Provides referential integrity.
  • It is quick and precise.

Difference between RDBMS and MongoDB:

MongoDB

RDBMS

Database

Document-oriented non-relational database. One collection holds different documents. Start coding without worrying about tables.

Relational database management system. First design tables, data structure, relations, and only then coding starts.

Language

Supports JSON & SQL query language.

Supports SQL query language.

Foreign key

No support for the foreign key. These constraints can be handled in code.

Supports foreign key

Complex Joins

No support for Complex Joins. Can be changed in document structure and embed the other document inside the first document.

Complex Joins are supported and take too much time to execute.

Schema

Dynamic schema

Predefined schema

SQL injection

Invulnerable

Vulnerable

Hierarchical data storage

Best-fit

Not fit

Triggers

Not-supported

Supported

Scalability

Horizontal

Vertical

Emphasize

CAP theorem (Consistency, Availability, and Partition tolerance).

ACID properties (Atomicity, Consistency, Isolation and Durability).

Speed

100 times faster than traditional database system.

Slower in comparison with the NoSQL databases.

JavaScript client

Provides JS client for querying.

Does not provide JS client for querying.

Based on

Collection & key-value, document, field

Table, Row, column