AnnouncementIntroducing MongoDB 8.0, the fastest MongoDB ever! Read more >>

MongoDB and Oracle Compared

Overview

Overview

In the 1970’s, Oracle Corporation became the first company to commercialize the relational database. At a time when software engineers were writing code on pads of paper, Oracle created software that provided tremendous gains in efficiency. The RDBMS became a standard and Oracle became one of most established and entrenched software vendors in the enterprise. Alternatives like MongoDB arrived within the past decade to address the changes in the way we store and manage data.

Today, modern enterprises are thinking about ways to better leverage their data -- whether it's to gain better customer insight, adapt to changing user expectations, or beat competitors to market with new applications and business models. As a result, many of the assumptions that drove the development of earlier relational databases have changed:

  • Demands for higher developer productivity and faster time to market, with traditional rigid relational data models and waterfall development of monolithic applications giving way to agile methodologies, microservices, and DevOps, compressing release cycles from months and years to days and weeks.

  • The need to manage massive increases in new, rapidly changing data types – structured, semi-structured, and polymorphic data generated by new classes of web, mobile, social, and IoT applications.

  • The wholesale shift to distributed systems and cloud computing, enabling developers to exploit on-demand, highly scalable compute and storage infrastructure, with the ability to serve audiences any place they work and play around the globe, while meeting a whole new set of regulatory demands for data sovereignty.

As a result, non-tabular databases, like MongoDB, have emerged in order to address the requirements of new applications, and modernize existing workloads. And with support for multi-document ACID transactions from MongoDB 4.0, it’s now even easier for developers to address use-cases that are now, or will in future, struggle with Oracle.

This page provides an overview of Oracle and MongoDB, and the appropriate use cases for each. You can learn more about the benefits of modernizing legacy systems and development processes by visiting our legacy modernization page.

What is Oracle?

What is Oracle?

Oracle is a global technology company specializing in database management systems. It’s core database offering is Oracle Database 12c Enterprise Edition (and forthcoming 18c). This is sold via a per-processing licensing model with required licensed add-ons for specific functionality. In Oracle, you pre-define your database schema based on your requirements. You then set up rules to govern the relationships between fields in your tables. Related information may be stored in separate tables. This information is then associated through the use of foreign keys and joins. Any changes in schema necessitates a migration procedure. This procedure can take the database offline or significantly reduce application performance.

What is MongoDB?

What is MongoDB?

MongoDB is a non-relational database developed by MongoDB, Inc. MongoDB stores data as documents in a binary representation called BSON (Binary JSON). Related information is stored together for fast query access through the MongoDB query language. Fields can vary from document to document; there is no need to declare the structure of documents to the system – documents are self-describing. If a new field needs to be added to a document, then the field can be created without affecting all other documents in the collection, without updating a central system catalog, and without taking the system offline. Optionally, schema validation can be used to enforce data governance controls over each collection.

MongoDB’s document data model maps naturally to objects in application code. This makes it simple for developers to learn and use. Documents give you the ability to represent hierarchical relationships to store arrays and other more complex structures easily.

Native, idiomatic drivers are provided for 12+ languages – and the community has built dozens more – enabling ad-hoc queries, real-time aggregation and rich indexing to provide powerful programmatic ways to access and analyze data of any structure.

Documents can bring together related data that would otherwise be modeled across separate parent-child tables in a relational schema. As a result, MongoDB’s atomic single-document operations already provide transaction semantics that meet the data integrity needs of the majority of applications. One or more fields may be written in a single operation. This includes updates to multiple sub-documents and elements of an array. The guarantees provided by MongoDB ensure complete isolation as a document is updated; any errors cause the operation to roll back so that clients receive a consistent view of the document.

Multi-document transactions make MongoDB the only database to combine the ACID guarantees of traditional relational databases, the speed, flexibility, and power of the document model, with the intelligent distributed systems design to scale-out and place data where you need it. Through snapshot isolation, transactions provide a consistent view of data, and enforce all-or-nothing execution to maintain data integrity. Transactions in MongoDB feel just like transactions developers are familiar with in Oracle. They are multi-statement, with similar syntax (e.g. start_transaction and commit_transaction), and therefore easy for anyone with prior transaction experience to add to any application.

Unlike Oracle and other relational databases, MongoDB is built on a distributed systems architecture, rather than a monolithic, single node design. As a result, MongoDB offers out-of-the-box scale-out and data localization with automatic sharding, and replica sets to maintain always-on availability.

Increasing Developer Productivity

Increasing Developer Productivity with MongoDB Atlas for the Edge and Serverless Platforms

Bring the power of the document model to your mobile and IoT devices with Atlas for the Edge. With local access to your data and the full MongoDB query language, your apps run faster, and keep on running – even when disconnected from the network. Atlas Device Sync keeps the data in MongoDB Atlas and all your devices in sync. There is no native mobile Oracle Enterprise database. When developers need to sync with the backend Oracle database, they are forced to use another database technology (such as SQLite or BerkeleyDB) and write bespoke, complex solutions, or to license expense database options, to sync with the backend Oracle database.

The Atlas App Services serverless platform is the best way to work with MongoDB. It cuts development time in half by taking care of mundane backend jobs such as service integrations, and getting data safely to your application frontend. Atlas App Services Data Access Controls let you execute any MongoDB query, right from inside your frontend app. Atlas App Services Triggers let your app respond in real time to data changes, wherever the changes originated. The trigger code is written and executed within Atlas, giving those triggers far more flexibility and making them easier to maintain than stored procedures and triggers in Oracle. Another benefit is that Atlas App Services Triggers do not consume valuable database resources. Oracle offers no equivalent way of working with data or services. This forces you to waste months writing thousands of lines of undifferentiated, boilerplate code, and then provisioning application servers to run it on.

Why use MongoDB

Why use MongoDB instead of Oracle?

Organizations of all sizes are adopting MongoDB because it enables them to build applications faster, handle highly diverse data types, and manage applications more efficiently at scale.

Development is simplified as MongoDB documents map naturally to modern, object-oriented programming languages. Using MongoDB removes the complex object-relational mapping (ORM) layer that translates objects in code to cells in relational tables.

When evaluating databases, it is critical to consider the relative costs of each solution -- not just the cost of the software, but also the hardware, development and deployment costs. Organizations save $ millions in cost by switching from Oracle to MongoDB as a result of gains in developer productivity, reduced licensing, and lower hardware requirements.

MongoDB can also be scaled within and across multiple distributed data centers. This provides new levels of availability and scalability previously unachievable with relational databases like Oracle. As your deployments grow in terms of data volume and throughput, MongoDB scales easily with no downtime, and without changing your application. In contrast, to achieve scale with Oracle often requires significant, custom engineering work or investment in expensive, custom hardware.

If MongoDB is the right solution for you and you’re currently using Oracle, check out our migration guide and MongoDB's Relational Migrator - a tool that simplifies migrating and transforming data from a relational database to MongoDB, de-risking your transition to MongoDB while helping you take full advantage of the document model.

Users Selecting MongoDB over Oracle

Users Selecting MongoDB over Oracle

As the following examples illustrate, MongoDB’s selection over Oracle is driven by radical improvements to developer productivity, application performance, and scale, while significantly reducing cost and lock-in:

To keep pace with demands from the business, Travelers Insurance modernized its development processes with a microservices architecture supported by agile and DevOps methodologies. But the rigidity of its existing Oracle and SQL Server databases imposed blockers to moving at the speed they needed. The solution was MongoDB and its flexible data model. They eliminated the 3-day wait to make any database changes, creating a software development pipeline supporting continuous delivery of new business functionality.

Financial giant RBS has modernized its investment banking systems with a new data fabric powered by MongoDB . As a result of decommissioning hundreds of Oracle servers, it has accelerated developer productivity to build new applications faster, created a simplified cloud-ready infrastructure for data scale, and avoided millions of dollars of cost.

Telefonica migrated its customer personalization service from Oracle to MongoDB. Using Oracle, it took 7 developers, multiple iterations and 14 months to build a system that just didn't perform. Using MongoDB, a team of 3 developers built its new personalization service in 3 months, which now powers both legacy and new products across the globe. MongoDB helps Telefonica be more agile, save money and drive new revenues streams.

China Eastern moved its from Oracle to MongoDB. Using MongoDB enabled the company’s project and engineering teams to build an application that was not possible with Oracle, transforming customer experience, and driving more business online. The simplicity of the document data model, dynamic schema, idiomatic drivers and indexing flexibility means the development teams can now launch new applications faster, while also unlocking significant cost savings.

Common Uses

MongoDB is a general purpose database that is used for a variety of use cases. The most common use cases for MongoDB include Single View, Artificial Intelligence, Internet of Things, Mobile, Real-Time Analytics, Edge Computing, Personalization, Catalog, and Content Management. With the addition of multi-document transactions, it is even easier for you to address a complete range of use cases with MongoDB.

When to use Oracle?

When would Oracle be a better fit?

While many organizations have successfully migrated from an RDBMS to MongoDB, you cannot drop-in MongoDB as a replacement for legacy applications built around the relational data model and SQL. However, organizations are benefiting from modernizing mission-critical, revenue generating applications to MongoDB. For example, from a legacy relational database to MongoDB. As a result, it has improved customer experience by reducing latency 8x and eliminated downtime during system upgrades. Cisco's development teams can build and release new applications faster, while the company’s e-commerce platform can tap into the business agility enabled by cloud computing.

Overview

In the 1970’s, Oracle Corporation became the first company to commercialize the relational database. At a time when software engineers were writing code on pads of paper, Oracle created software that provided tremendous gains in efficiency. The RDBMS became a standard and Oracle became one of most established and entrenched software vendors in the enterprise. Alternatives like MongoDB arrived within the past decade to address the changes in the way we store and manage data.

Today, modern enterprises are thinking about ways to better leverage their data -- whether it's to gain better customer insight, adapt to changing user expectations, or beat competitors to market with new applications and business models. As a result, many of the assumptions that drove the development of earlier relational databases have changed:

  • Demands for higher developer productivity and faster time to market, with traditional rigid relational data models and waterfall development of monolithic applications giving way to agile methodologies, microservices, and DevOps, compressing release cycles from months and years to days and weeks.

  • The need to manage massive increases in new, rapidly changing data types – structured, semi-structured, and polymorphic data generated by new classes of web, mobile, social, and IoT applications.

  • The wholesale shift to distributed systems and cloud computing, enabling developers to exploit on-demand, highly scalable compute and storage infrastructure, with the ability to serve audiences any place they work and play around the globe, while meeting a whole new set of regulatory demands for data sovereignty.

As a result, non-tabular databases, like MongoDB, have emerged in order to address the requirements of new applications, and modernize existing workloads. And with support for multi-document ACID transactions from MongoDB 4.0, it’s now even easier for developers to address use-cases that are now, or will in future, struggle with Oracle.

This page provides an overview of Oracle and MongoDB, and the appropriate use cases for each. You can learn more about the benefits of modernizing legacy systems and development processes by visiting our legacy modernization page.

What is Oracle?

Oracle is a global technology company specializing in database management systems. It’s core database offering is Oracle Database 12c Enterprise Edition (and forthcoming 18c). This is sold via a per-processing licensing model with required licensed add-ons for specific functionality. In Oracle, you pre-define your database schema based on your requirements. You then set up rules to govern the relationships between fields in your tables. Related information may be stored in separate tables. This information is then associated through the use of foreign keys and joins. Any changes in schema necessitates a migration procedure. This procedure can take the database offline or significantly reduce application performance.

What is MongoDB?

MongoDB is a non-relational database developed by MongoDB, Inc. MongoDB stores data as documents in a binary representation called BSON (Binary JSON). Related information is stored together for fast query access through the MongoDB query language. Fields can vary from document to document; there is no need to declare the structure of documents to the system – documents are self-describing. If a new field needs to be added to a document, then the field can be created without affecting all other documents in the collection, without updating a central system catalog, and without taking the system offline. Optionally, schema validation can be used to enforce data governance controls over each collection.

MongoDB’s document data model maps naturally to objects in application code. This makes it simple for developers to learn and use. Documents give you the ability to represent hierarchical relationships to store arrays and other more complex structures easily.

Native, idiomatic drivers are provided for 12+ languages – and the community has built dozens more – enabling ad-hoc queries, real-time aggregation and rich indexing to provide powerful programmatic ways to access and analyze data of any structure.

Documents can bring together related data that would otherwise be modeled across separate parent-child tables in a relational schema. As a result, MongoDB’s atomic single-document operations already provide transaction semantics that meet the data integrity needs of the majority of applications. One or more fields may be written in a single operation. This includes updates to multiple sub-documents and elements of an array. The guarantees provided by MongoDB ensure complete isolation as a document is updated; any errors cause the operation to roll back so that clients receive a consistent view of the document.

Multi-document transactions make MongoDB the only database to combine the ACID guarantees of traditional relational databases, the speed, flexibility, and power of the document model, with the intelligent distributed systems design to scale-out and place data where you need it. Through snapshot isolation, transactions provide a consistent view of data, and enforce all-or-nothing execution to maintain data integrity. Transactions in MongoDB feel just like transactions developers are familiar with in Oracle. They are multi-statement, with similar syntax (e.g. start_transaction and commit_transaction), and therefore easy for anyone with prior transaction experience to add to any application.

Unlike Oracle and other relational databases, MongoDB is built on a distributed systems architecture, rather than a monolithic, single node design. As a result, MongoDB offers out-of-the-box scale-out and data localization with automatic sharding, and replica sets to maintain always-on availability.

Increasing Developer Productivity with MongoDB Atlas for the Edge and Serverless Platforms

Bring the power of the document model to your mobile and IoT devices with Atlas for the Edge. With local access to your data and the full MongoDB query language, your apps run faster, and keep on running – even when disconnected from the network. Atlas Device Sync keeps the data in MongoDB Atlas and all your devices in sync. There is no native mobile Oracle Enterprise database. When developers need to sync with the backend Oracle database, they are forced to use another database technology (such as SQLite or BerkeleyDB) and write bespoke, complex solutions, or to license expense database options, to sync with the backend Oracle database.

The Atlas App Services serverless platform is the best way to work with MongoDB. It cuts development time in half by taking care of mundane backend jobs such as service integrations, and getting data safely to your application frontend. Atlas App Services Data Access Controls let you execute any MongoDB query, right from inside your frontend app. Atlas App Services Triggers let your app respond in real time to data changes, wherever the changes originated. The trigger code is written and executed within Atlas, giving those triggers far more flexibility and making them easier to maintain than stored procedures and triggers in Oracle. Another benefit is that Atlas App Services Triggers do not consume valuable database resources. Oracle offers no equivalent way of working with data or services. This forces you to waste months writing thousands of lines of undifferentiated, boilerplate code, and then provisioning application servers to run it on.

Why use MongoDB instead of Oracle?

Organizations of all sizes are adopting MongoDB because it enables them to build applications faster, handle highly diverse data types, and manage applications more efficiently at scale.

Development is simplified as MongoDB documents map naturally to modern, object-oriented programming languages. Using MongoDB removes the complex object-relational mapping (ORM) layer that translates objects in code to cells in relational tables.

When evaluating databases, it is critical to consider the relative costs of each solution -- not just the cost of the software, but also the hardware, development and deployment costs. Organizations save $ millions in cost by switching from Oracle to MongoDB as a result of gains in developer productivity, reduced licensing, and lower hardware requirements.

MongoDB can also be scaled within and across multiple distributed data centers. This provides new levels of availability and scalability previously unachievable with relational databases like Oracle. As your deployments grow in terms of data volume and throughput, MongoDB scales easily with no downtime, and without changing your application. In contrast, to achieve scale with Oracle often requires significant, custom engineering work or investment in expensive, custom hardware.

If MongoDB is the right solution for you and you’re currently using Oracle, check out our migration guide and MongoDB's Relational Migrator - a tool that simplifies migrating and transforming data from a relational database to MongoDB, de-risking your transition to MongoDB while helping you take full advantage of the document model.

Users Selecting MongoDB over Oracle

As the following examples illustrate, MongoDB’s selection over Oracle is driven by radical improvements to developer productivity, application performance, and scale, while significantly reducing cost and lock-in:

To keep pace with demands from the business, Travelers Insurance modernized its development processes with a microservices architecture supported by agile and DevOps methodologies. But the rigidity of its existing Oracle and SQL Server databases imposed blockers to moving at the speed they needed. The solution was MongoDB and its flexible data model. They eliminated the 3-day wait to make any database changes, creating a software development pipeline supporting continuous delivery of new business functionality.

Financial giant RBS has modernized its investment banking systems with a new data fabric powered by MongoDB . As a result of decommissioning hundreds of Oracle servers, it has accelerated developer productivity to build new applications faster, created a simplified cloud-ready infrastructure for data scale, and avoided millions of dollars of cost.

Telefonica migrated its customer personalization service from Oracle to MongoDB. Using Oracle, it took 7 developers, multiple iterations and 14 months to build a system that just didn't perform. Using MongoDB, a team of 3 developers built its new personalization service in 3 months, which now powers both legacy and new products across the globe. MongoDB helps Telefonica be more agile, save money and drive new revenues streams.

China Eastern moved its from Oracle to MongoDB. Using MongoDB enabled the company’s project and engineering teams to build an application that was not possible with Oracle, transforming customer experience, and driving more business online. The simplicity of the document data model, dynamic schema, idiomatic drivers and indexing flexibility means the development teams can now launch new applications faster, while also unlocking significant cost savings.

MongoDB is a general purpose database that is used for a variety of use cases. The most common use cases for MongoDB include Single View, Artificial Intelligence, Internet of Things, Mobile, Real-Time Analytics, Edge Computing, Personalization, Catalog, and Content Management. With the addition of multi-document transactions, it is even easier for you to address a complete range of use cases with MongoDB.

When would Oracle be a better fit?

While many organizations have successfully migrated from an RDBMS to MongoDB, you cannot drop-in MongoDB as a replacement for legacy applications built around the relational data model and SQL. However, organizations are benefiting from modernizing mission-critical, revenue generating applications to MongoDB. For example, from a legacy relational database to MongoDB. As a result, it has improved customer experience by reducing latency 8x and eliminated downtime during system upgrades. Cisco's development teams can build and release new applications faster, while the company’s e-commerce platform can tap into the business agility enabled by cloud computing.

Terminology and Concepts

Many concepts in Oracle have close analogs in MongoDB. The table below outlines the common concepts across Oracle and MongoDB.

OracleMongoDB
ACID TransactionsACID Transactions
TableCollection
RowDocument
ColumnField
Secondary IndexSecondary Index
JOINsEmbedded documents, $lookup & $graphLookup
GROUP_BYAggregation Pipeline
Oracle
ACID Transactions
Table
Row
Column
Secondary Index
JOINs
GROUP_BY
MongoDB
ACID Transactions
Collection
Document
Field
Secondary Index
Embedded documents, $lookup & $graphLookup
Aggregation Pipeline

Feature Comparison

Like Oracle, MongoDB offers a rich set of features and functionality far beyond those offered by simple NoSQL data stores. MongoDB has a rich query language, highly-functional secondary indexes (including text search and geospatial), a powerful aggregation framework for data analysis, faceted search, graph processing and more. With MongoDB you can also make use of these features across more diverse data types than a relational database, and you can do it at scale.

OracleMongoDBNoSQL Data Store
ACID Transactions
Flexible, rich data model
Partial: schema flexibility but support for only simple data structures
Schema governance
Expressive joins, faceted search, graphs queries, powerful aggregations
Idiomatic, native language drivers
Horizontal scale-out with data locality controls
Partial: no controls over data locality
Analytics and BI ready
Enterprise grade security and mature management tools
Database as a service on all major cloudsPartial: AWS and Oracle cloud
Oracle
ACID Transactions
Flexible, rich data model
Schema governance
Expressive joins, faceted search, graphs queries, powerful aggregations
Idiomatic, native language drivers
Horizontal scale-out with data locality controls
Analytics and BI ready
Enterprise grade security and mature management tools
Database as a service on all major cloudsPartial: AWS and Oracle cloud
MongoDB
ACID Transactions
Flexible, rich data model
Schema governance
Expressive joins, faceted search, graphs queries, powerful aggregations
Idiomatic, native language drivers
Horizontal scale-out with data locality controls
Analytics and BI ready
Enterprise grade security and mature management tools
Database as a service on all major clouds
NoSQL Data Store
ACID Transactions
Flexible, rich data modelPartial: schema flexibility but support for only simple data structures
Schema governance
Expressive joins, faceted search, graphs queries, powerful aggregations
Idiomatic, native language drivers
Horizontal scale-out with data locality controls Partial: no controls over data locality
Analytics and BI ready
Enterprise grade security and mature management tools
Database as a service on all major clouds

Query Language

Both Oracle and MongoDB have a rich query language. Below are a few examples of SQL statements and how they map to MongoDB. A more comprehensive list of statements can be found in the MongoDB documentation.

OracleMongoDB
INSERT INTO users (user_id, age, status) VALUES ('bcd001', 45, 'A')db.users.insert({ user_id: 'bcd001', age: 45, status: 'A' })
SELECT * FROM usersdb.users.find()
UPDATE users SET status = 'C' WHERE age > 25db.users.update( { age: { $gt: 25 } }, { $set: { status: 'C' } }, { multi: true } )
db.start_transaction() cursor.execute(orderInsert, orderData) cursor.execute(stockUpdate, stockData) db.commit()s.starttransaction() orders.insertone(order, session=s) stock.updateone(item, stockUpdate, session=s) s.committransaction()
Oracle
INSERT INTO users (user_id, age, status) VALUES ('bcd001', 45, 'A')
SELECT * FROM users
UPDATE users SET status = 'C' WHERE age > 25
db.start_transaction() cursor.execute(orderInsert, orderData) cursor.execute(stockUpdate, stockData) db.commit()
MongoDB
db.users.insert({ user_id: 'bcd001', age: 45, status: 'A' })
db.users.find()
db.users.update( { age: { $gt: 25 } }, { $set: { status: 'C' } }, { multi: true } )
s.starttransaction() orders.insertone(order, session=s) stock.updateone(item, stockUpdate, session=s) s.committransaction()
Want to Learn More? Get our guide to relational database migration.

A step-by-step guide for project teams that want to know how to migrate to MongoDB, covering schema design, query language, and moving data. It also explains the considerations for teams that come from relational database backgrounds and want to build new applications on MongoDB.