Evaluating Amazon DocumentDB Compatibility with MongoDB

Amazon claims that migrating from MongoDB to DocumentDB is “as easy as changing the database endpoint to the new Amazon DocumentDB cluster”.

We assessed DocumentDB’s compatibility claims by running 5 MongoDB test suites, totaling over 1,000 tests, against DocumentDB’s API emulation. This is the suite that we use to test MongoDB’s conformity and correctness on every database release, and is the best representation of what the full MongoDB API is.

The tests comprise:

jsCore: over 800 tests of MongoDB CRUD operations and database commands

aggregation: over 150 tests of the MongoDB aggregation pipeline

jsCore_decimal: evaluates correct behavior of applications using the decimal data type for high precision, fractional numeric data typical in financial and scientific workloads

jsonSchema: tests the data governance controls provided by MongoDB

change_streams: tests MongoDB change streams, used by developers to build event-driven data pipelines that react in real time to database changes

At the time of testing, DocumentDB emulates a subset of the MongoDB 3.6 protocol. Unlike DocumentDB, MongoDB Atlas — the fully managed MongoDB service — supports the latest MongoDB 4.2 release/mongodb-4.2)

Test Results

61% of all of the correctness tests failed when running against the DocumentDB API emulation. For developers, this means that:

  1. Any existing MongoDB apps relying on this functionality would need to be re-engineered if they are to be migrated to DocumentDB

  2. Any new apps written against the DocumentDB API only support a subset of MongoDB’s functionality

  3. Any application written for DocumentDB will be locked-in to AWS.

Number of TestsSucceededFailed
jsCore843339504
aggregation1505694
jsCore_Decimal1376
change_streams*10010
jsonSchema*24024
Totals1,040402638

*Feature not supported by the DocumentDB API emulation

In terms of functionality, DocumentDB most closely resembles MongoDB 2.6, which was released in 2014. As a result, developers will need to either:

  1. Reimplement required database functionality back in the application tier, slowing down the pace of application development

  2. Move multiple copies of the data into adjacent AWS technologies, with the associated increases in development and operational costs and platform complexity

Key gaps include:

  • No support for multi-statement ACID transactions; with no sharding support, there is no way to enable distributed transactions that span multiple partitions of the data
  • Only a small subset of the MongoDB Query Language is supported by DocumentDB.
  • Less than 50% of MongoDB 3.6 aggregation pipeline stages and query language operators are supported.
  • No on-demand materialized views
  • No schema governance to control data quality
  • No change streams to support reactive, event-driven data pipelines
  • There is no way to index arrays in embedded documents, which is required to efficiently query complex data structures typical in product catalogs, content management, telemetry data and logs used in IoT and monitoring systems
  • No decimal data type, so there is no way to preserve the fidelity of complex numeric data used in financial and scientific apps
  • Restricted index length limit, resulting in the creation failure of some indexes
  • Limited cursor options: no support for hint, collation, or tailable cursors
  • No causal consistency guarantees, reducing data quality by eliminating the ability to perform monotonic reads across replicas
  • DocumentDB does not implement the MongoDB API’s tunable consistency options. Even in cases which call for higher throughput and reduced durability guarantees, like streaming IoT sensor data, user tracking, or large-scale social media platforms, clients must wait for all writes to reach a majority of those nodes

In contrast, Atlas is updated as soon as each new database release is declared as Generally Available, meaning developers don’t have to wait months or years to access the latest platform enhancements. The service is backed by thousands of support engineers, consultants, and solutions architects from MongoDB and the partner ecosystem who offer the benefits of collective MongoDB knowledge acquired supporting tens of thousands of MongoDB customers over the past decade.

Fully managed MongoDB

Spin up a free cluster in minutes

Already have an account? Sign in.

Included with your free cloud database:

  • 512 MB of Storage
  • Shared RAM
  • Highly available replica sets, end-to-end encryption, automated patches, REST API

Additionally, get access to the following when you launch a dedicated cluster:

  • 10 GB or more of storage
  • Dedicated RAM
  • Performance optimization tools
  • Backups & point-in-time recovery
  • Enterprise security features including encryption key management, LDAP integration, and granular database auditing
  • Global Clusters