Let us understand the basic differences between MongoDB and RDBMS such as Oracle, MySQL, Postgres etc.
- RDBMS stands for Relational Database Management System.
- Relational Databases are primarily used for those applications where complex transactions are involved – e. g.: Retail PoS, Consumer Banking etc.
- NoSQL Databases are popular for those applications where there are no complex transactions involved – e.g.: Registration Systems, Recommendation Engines, Content Management, Referral Systems and more
- Each element is considered as Document and group of Documents are known as Collections whereas we call them as row and table in traditional RDBMS.
- There are no Primary Key or Foreign Key Constraints and hence relationships cannot be enforced at the Database level in MongoDB.
- In RDBMS, we need to use pre-defined schema while creating a table – which means we need to specify column names and Data Types. When we create collections in MongoDB, there is no pre-defined schema. Each row can have completely different columns.
- If we have a normalized data model in MongoDB, we need to enforce relationship at the application level.
- Unlike RDBMS, we cannot commit or rollback group of operations as one transaction.