Friday, 13 July 2018

Difference between mongoDB and Oracle

Before starting out with the difference between mongoDB and Oracle let us go through about both the databases in brief.

Oracle


Oracle is an object-relational database system that comprises of table-column-row (TCR) structure. The data in oracle database is stored logically in tables. These tables are then logically grouped in tablespaces. Oracle database physically stores data in data files. Tablespaces contain segments. These segments are made of one or more extents. An extent is the collection of contiguous data blocks. Thus data blocks are basic units of data storage in Oracle.

mongoDB


mongoDB is a NoSQL document-oriented database. It is basically a class and object (CO) structured database. mongoDB contains multiple databases. Each database comprises of collections. A collection is formed of one or more documents. These documents contain fields where data is stored in the form of key-value pair.

mongoDB and Oracle Database, Oracle Database Certifications, Oracle Database Study Materials

As you are clear now with the basic understanding of both the databases let us look at its differences

Difference between mongoDB and Oracle


ORACLE mongoDB 
Table In RDBMS, the table consists of rows and columns.  Table is similar to collection in mongoDB where data is stored in fields made up of key-value pair. 
Row In Oracle, the row represents a single implicit record. It is structured with pre-defined column names.  Similar to row in RDMS the records in mongoDB is stored in documents. 
Column A set of data values in RDMS is called column.  Column in mongoDB is denoted by Field.
Normalization Basically normalization is the best practice in RDMS as it prevents data redundancy and maintains integrity.  Normalization is not required in mongoDB as it attains flexibility due to its key-value pair structure. 
Structure Oracle consists of Table-Column-Row (TCR) structure.  mongoDB is equivalent to Classes and Objects (CO) structure. 
Joins To get the complete view of data based on business requirements joins between multiple tables are inevitable in Oracle.  In mongoDB the data is stored in a single collection, but separated by using embedded documents. Concept of join is not available in mongoDB. 
Schema Schemas are pre-defined in Oracle.  mongoDB have dynamic schema which is best suited for unstructured data.
Primary Key Any column or set of columns can be defined as primary key.  Have_id as default key that serves as primary key. 
Scalability  Oracle RDMS database is vertically scalable. mongoDB is scaled horizontally.
Application Oracle is best suited for query intensive environment where data is required to be structured before using it. mongoDB is best suited for unstructured data that is available in today’s world in the form of social media and multiple other sources.