Amazon DocumentDB
A fully managed document database with MongoDB-compatible APIs that provides scalable JSON document storage, querying, and indexing
Overview
Amazon DocumentDB (with MongoDB compatibility) is a fully managed document database service that provides MongoDB-compatible APIs (3.6 / 4.0 / 5.0 / 8.0 as of August 2026). Internally, it uses a distributed storage architecture similar to Aurora, with storage automatically replicated across 6 copies in 3 AZs. It comes standard with up to 15 read replicas, automatic backups, point-in-time recovery, and encryption at rest and in transit. Since you can use existing MongoDB drivers and tools as-is, you can migrate existing MongoDB applications with minimal changes.
MongoDB Compatibility and Where It Diverges
DocumentDB is compatible with the MongoDB wire protocol, but it is not MongoDB itself. Understanding this distinction precisely is essential to avoid unexpected behavior after migration. Compatible features include CRUD operations, aggregation pipelines, indexes (single-field, compound, multi-key, geospatial, and text from 5.0 compatibility onward), transactions (4.0 compatible), and Change Streams. Incompatible features include the $where operator, server-side JavaScript execution, Capped Collections, and aggregation stages whose support varies by version (for example, as of October 2026, $merge is supported only with 8.0 compatibility). For migrations from MongoDB Atlas, AWS Database Migration Service (DMS) enables online migration with minimal downtime. It's strongly recommended to use DocumentDB's compatibility testing tool before migration to verify that the APIs your application uses are supported. DocumentDB trails upstream MongoDB releases with a time lag, and even on supported compatibility versions, not every feature is available. If your application depends on version-specific features, check the official compatibility documentation before deciding between DocumentDB and MongoDB Atlas.
Instance Class Selection and Cost Optimization
According to the official AWS pricing page, instance-based cluster costs consist of four components in the standard configuration (instances, I/O, storage, and backup storage), while the I/O-Optimized configuration has no I/O charges (as of October 2026). Instance classes are available in families such as R5, R6G (Graviton2), R8G, T3, and T4G. Whether the working set fits in instance memory is the critical performance threshold - when it doesn't, disk I/O increases and latency degrades sharply. If the CloudWatch BufferCacheHitRatio metric is lower than expected, consider scaling up the instance class. For read-heavy workloads, add read replicas and distribute reads from the application side. DocumentDB Elastic Clusters enable horizontal scaling through sharding, handling millions of read/write requests per second and petabyte-scale storage.
Choosing Between DocumentDB and DynamoDB
DocumentDB and DynamoDB are both NoSQL databases, but their data models and access patterns are fundamentally different. DynamoDB is a key-value/wide-column store that requires you to design access patterns around partition keys and sort keys upfront. Single-table design achieves extremely high throughput with single-digit millisecond latency, but it's not suited for ad-hoc queries or complex aggregations. DocumentDB is a document store that allows you to create indexes on arbitrary fields for flexible querying. It offers RDB-like flexibility with aggregation pipelines for complex data transformations, partial updates on nested JSON documents, and regex-based searches. As a guideline: choose DynamoDB when access patterns are well-defined and ultra-high throughput is required; choose DocumentDB when schemas change frequently and ad-hoc queries are common. Content management systems, user profiles, and catalog data - where document structures are complex and search criteria are diverse - are cases where DocumentDB's flexibility shines.
References (Official AWS Resources)
The primary sources for this page are the official AWS website and documentation. Check the official pages below for the latest specifications and pricing.
- Amazon DynamoDB official page
- Amazon RDS official page
- AWS Database Migration Service official page
- AWS Documentation (official)
If this page and the official documentation disagree, treat the official documentation as authoritative.