1 Overview of Oracle Database API for MongoDB

Oracle Database API for MongoDB lets applications interact with collections of JSON documents in Oracle Database using MongoDB commands.

Oracle Database API for MongoDB is available on these Autonomous Oracle Databases with shared infrastructure: Autonomous JSON Database and Autonomous Transaction Processing. It is not available on Autonomous Data Warehouse or Autonomous Database with dedicated infrastructure.

See Also:

Using the Oracle Database API for MongoDB in Using Oracle Autonomous Database on Shared Exadata Infrastructure for information about using an Autonomous Database (including an Autonomous JSON Database) with Oracle Database API for MongoDB. This covers configuring the database for use with the API, including for security and connection.

1.1 Purpose of Oracle Database API for MongoDB

Oracle Database understands Mongo-speak. That's the purpose of Oracle Database API for MongoDB.

You have one or more applications that interact with a MongoDB NoSQL database. You're used to using MongoDB commands, particularly for the business logic of your applications (query by example — QBE) but also for data definition (creating collections and indexes), data manipulation (CRUD operations), and some database administration (status information). You expect and depend on the flexibility of a JSON document store: no fixed data schemas, easy to use document-centric APIs.

On the other hand, you're looking to future-proof your applications and make them more robust. You want advanced security; fully ACID transactions (atomicity, consistency, isolation, durability); standardized, straightforward JOINs with all sorts of data; and state-of-the-art analytics, machine-learning, and reporting capabilities — all that and more, out of the box.

Oracle Database API for MongoDB, or Mongo API for short, provides all of that. It translates the MongoDB wire protocol into SQL statements that are executed by Oracle Database. This means you can continue to use the drivers, frameworks, and tools you're used to, to develop your JSON document-store applications.

Oracle Database is a converged database, which opens a whole new world to your applications. It's multi-model and polyglot — seemingly different kinds of databases rolled into one, providing synergy across very different features, supporting different workloads and data models.

Oracle Database is also multitenant, which means you can have both consolidation and isolation, for different teams and purposes. And it provides a single, common approach for security, upgrades, patching, and maintenance. But if you use an Autonomous Oracle Database, such as Autonomous JSON Database, then Oracle takes care of all such database administration responsibilities. And there's Always Free access to an autonomous database.

The standard, declarative language SQL (Structured Query Language) underlies processing on Oracle Database. You might develop your application using Mongo-speak or Simple Oracle Document Access (SODA) with a popular application development language, but SQL is behind it all, and it enables your app to play well with everything else on Oracle Database.

1.2 Tools and Drivers for Oracle Database API for MongoDB

Oracle Database API for MongoDB supports a variety of MongoDB tools and drivers.

Oracle recommends that you use the following tool and driver versions, or higher, with support for load-balanced connections.

  • C 1.19.0

  • C# 2.13.0

  • Compass 1.28.1

  • Database Tools 100.5.0 (includes mongoexport, mongorestore, and mongodump)

  • Go 1.6.0

  • Java 4.3.0

  • MongoSH 0.15.6

  • Node.js driver 4.1.0

  • PyMongo 3.12.0 (for Python language)

  • Ruby 2.16.0

  • Rust 2.1.0

You can download these drivers from https://www.mongodb.com/docs/drivers/.

1.3 Terms and Concepts: MongoDB and Oracle Database

Some application-user terms and concepts used by MongoDB are presented, together with description of their relation to Oracle Database..

Some of the same terms are also used in Oracle Database API for MongoDB. In general, application developers need not be concerned with the Oracle Database concepts and technologies that underlie such terms.

Table 1-1 Application-User Terms

Term Description

A set of collections.

On Oracle Database this corresponds to a database schema.

Because of this possible confusion over use of the word database, in this documentation that word is used for Oracle Database, and the term schema, or database schema, is used for what MongoDB calls a "database".


For log-in purposes, a user of Oracle Database API for MongoDB is an Oracle Database user, which is also called a database schema (see previous).

To use the collections in a given schema ("database") , you log in with the Oracle Database API for MongoDB using the MongoDB PLAIN $external mechanism and providing the credentials for that schema.

A root user, that is, a user who has MongoDB role root, can create additional database schemas. And a root user can use the collections of any schema without needing to log in separately for that schema. See command saslStart in Authentication and Authorization Commands.


A collection contains a set of documents.

A collection name is unique for a given database schema: Different collections can have the same name if they are in different schemas.

On Oracle Database, a table or a view underlies a collection. The table name is derived from the collection name and is typically the same. (Exceptions include collection names that use words reserved by Oracle Database.) Typically all documents in a collection are JSON documents.


The basic unit of storage for data in a collection.

On Oracle Database a document corresponds roughly to a row in the table or view that underlies the collection.

A document is typically a JSON document, that is, it contains only JSON data. On Oracle Autonomous Database a document is always a JSON document.

On Oracle Autonomous Database the table column used to store documents is named data.

Primary Key

On Oracle Database a primary key is used to uniquely identify a table or view row.

MongoDB uses a unique _id field in a document to identify the document. On Oracle Database the primary key for a JSON document is stored in a column named id. Its value is automatically set to the value of the document's _id field. See Document Key: Differences and Conversion.


A Query By Example JSON object, which is sent by an application client to the server (Oracle Database), to act on documents of a collection.

The QBE object can contain QBE operator fields, whose names start with $. The operators are interpreted, and their operations are invoked to act on the collection. The server returns the action results to the client.

QBEs are typically used to query a collection, but they can also be used to project or update data in documents.

Oracle Database API for MongoDB translates QBEs into SQL (Structured Query Language) queries.


Indexes enhance performance when acting on collections (querying, inserting, updating, and deleting documents).

An index name is unique for a given database schema: Different indexes can have the same name if they are in different schemas.

Note: MongoDB commands to create or drop indexes are ignored by Oracle Database API for MongoDB. You must instead create Oracle Database indexes that are relevant for your JSON data.


MongoDB aggregation operations chain multiple operations together, invoking them sequentially as a pipeline. Aggregation operations are carried out differently using Oracle Database API for MongoDB — pipelines are not used. See Replace MongoDB Aggregation Pipelines.

See Also: