Database Migration Guide
MongoDB Atlas to Amazon DocumentDB: Migration Guide and Comparison
An honest guide to MongoDB Atlas vs Amazon DocumentDB — covering compatibility gaps, migration steps with AWS DMS, cost comparison, and when each service is the right choice.
MongoDB Atlas to Amazon DocumentDB is one of the most nuanced database migrations you can undertake. On the surface it looks straightforward — DocumentDB speaks the MongoDB wire protocol, so your drivers connect. The complexity lives in the gaps between what DocumentDB advertises and what MongoDB actually delivers.
This guide does not sugarcoat the compatibility story. We will cover what works, what does not, when DocumentDB is a reasonable choice, and when you should stay on Atlas or consider a different AWS-native option.
We are an AWS Select Tier Consulting Partner, and we have handled Atlas-to-DocumentDB migrations. The advice here reflects production experience, not vendor documentation.
The Compatibility Gap: What DocumentDB Does Not Support
This is the section most vendor comparisons skip. Read it before you start planning a migration.
| Feature | MongoDB Atlas | Amazon DocumentDB | Notes |
|---|---|---|---|
| Full-text search | Atlas Search (Lucene-powered) | Not supported | Use Amazon OpenSearch Service alongside DocumentDB |
| Change streams | Full support, collection + database level | Collection-level only, with restrictions | No db-level or deployment-level change streams |
| $lookup (join) | Full support including uncorrelated subqueries | Partial — no uncorrelated subqueries | Rewrite complex joins before migrating |
| $unionWith | Supported (MongoDB 4.4+) | Not supported | Requires application-level workaround |
| $accumulator / $function | Supported | Not supported | Custom JS aggregation operators unavailable |
| Time series collections | MongoDB 5.0+ | Not supported | Use Timestream or Redshift for time series |
| MongoDB version | Tracks upstream releases | 4.0 and 5.0 wire protocol only | Does not receive MongoDB feature releases |
| Transactions | Multi-document ACID | Single-region only; no cross-collection in all configs | Review transaction patterns carefully |
| Atlas Vector Search | Supported | Not supported | Use Amazon OpenSearch with k-NN instead |
| Atlas App Services | Supported | Not available | No DocumentDB equivalent |
The bottom line on compatibility: For CRUD-heavy applications that do not use Atlas Search, complex aggregations, or change streams at the database level, DocumentDB’s wire protocol compatibility is adequate. For applications that use these features, you are not migrating to DocumentDB — you are rewriting parts of your application.
When DocumentDB Makes Sense
DocumentDB is a reasonable choice in specific situations:
- AWS-only vendor requirement. Some regulated environments or enterprise procurement policies require all data services to be native AWS services. Atlas runs on AWS infrastructure but is managed by MongoDB Inc., not AWS. DocumentDB satisfies this constraint.
- Operational simplicity over feature completeness. If your team finds Atlas’s operational model complex (cross-cloud replication, Atlas alerts, Atlas Data Federation), DocumentDB integrates more naturally into your existing AWS tooling — CloudWatch, VPC security groups, IAM authentication.
- Your workloads fit the compatibility matrix. If your application is a document store for structured JSON with standard CRUD operations and simple queries, DocumentDB’s supported feature set may be entirely sufficient.
- Cost modeling favors DocumentDB. For low-I/O workloads, DocumentDB’s unbundled pricing can be cheaper than Atlas.
When Atlas Is the Better Choice
Atlas is the stronger option when:
- You use Atlas Search for full-text or relevance-based queries — there is no DocumentDB equivalent. The nearest AWS option is OpenSearch Service, which requires a separate migration.
- You use Atlas Vector Search for semantic similarity search or RAG pipelines.
- You use MongoDB 6.0 or later features.
- Your application relies on change streams at the database or deployment level.
- You use Atlas App Services, Atlas Data Federation, or Atlas Charts.
- You need multi-cloud replication (Atlas runs on AWS, GCP, and Azure; DocumentDB is AWS-only).
Cost Comparison
DocumentDB uses an unbundled pricing model. The instance price is only part of the cost.
| Tier | MongoDB Atlas | Amazon DocumentDB |
|---|---|---|
| Entry-level (4 GB) | M10 — ~$57/month (all-inclusive) | db.t3.medium — ~$54/month + storage + I/Os |
| Mid-tier (16 GB) | M30 — ~$209/month (all-inclusive) | db.r5.large — ~$196/month + storage + I/Os |
| Storage (per GB/month) | Included in instance price | $0.10/GB-month (charged separately) |
| I/Os | Included in instance price | $0.20/million I/Os (charged separately) |
| Backup | First 1× cluster size included | $0.021/GB-month |
Worked example: A db.r5.large with 100 GB of data and 500 million I/Os per month costs: $196 (instance) + $10 (storage) + $100 (I/Os) = $306/month. The comparable Atlas M30 with 100 GB NVMe storage is approximately $209/month all-inclusive.
Write-heavy workloads can make DocumentDB significantly more expensive than Atlas pricing suggests. Model your I/O before assuming cost parity.
Migration Approach: Atlas to DocumentDB with AWS DMS
Step 1: Compatibility Audit
Run your queries and aggregation pipelines against the DocumentDB compatibility matrix. Check for $lookup with subqueries, $unionWith, custom $accumulator or $function operators, and any full-text or vector search usage. Fix or rewrite incompatible patterns before proceeding.
Step 2: Driver Compatibility
For best compatibility with DocumentDB, use the MongoDB 3.x driver rather than 4.x or later. The 4.x driver introduced connection behavior changes that can cause issues with DocumentDB’s connection handling. Check the AWS documentation for your language’s recommended driver version.
Step 3: Provision DocumentDB Cluster
Create your DocumentDB cluster inside your VPC. DocumentDB does not support public endpoints — your application must connect from within the VPC or via a VPN/Direct Connect. Enable TLS (required) and download the AWS-provided CA certificate bundle for your connection string.
Step 4: Migrate Data with AWS DMS
Configure AWS DMS with your Atlas cluster as the source and your DocumentDB cluster as the target. Use full-load mode for the initial migration, then enable ongoing replication (change data capture) to keep DocumentDB in sync while you test your application. DMS supports MongoDB as a source natively.
Validate document counts and spot-check data integrity after the full load completes.
Step 5: Update Connection Strings
DocumentDB connection strings use mongodb:// format but require the retryWrites=false parameter — DocumentDB does not support retryable writes in the same way MongoDB does. Example:
mongodb://user:pass@docdb-cluster.cluster-xxxx.us-east-1.docdb.amazonaws.com:27017/?ssl=true&ssl_ca_certs=rds-combined-ca-bundle.pem&retryWrites=falseStep 6: Application Testing and Cutover
Run your full integration test suite against DocumentDB. Pay particular attention to any code paths that use aggregation pipelines, change streams, or text queries. Once validated, cut over your application by updating the connection string, then decommission the Atlas cluster.
A Note on Full-Text Search
If your application uses MongoDB Atlas Search, you have two AWS options:
- Amazon OpenSearch Service — A dedicated search cluster running OpenSearch (Elasticsearch-compatible). Provides full-text search, facets, relevance tuning, and vector k-NN search. Requires maintaining a separate service alongside DocumentDB.
- Amazon OpenSearch Serverless — Serverless version with no cluster management. Good for variable query volumes.
Neither is as seamlessly integrated as Atlas Search, which runs embedded within your MongoDB cluster. Factor this operational complexity into your migration timeline.
Ready to Migrate?
FactualMinds handles database migrations to AWS, including Atlas-to-DocumentDB migrations with DMS and post-migration optimization.
Talk to our team about your database migration or learn more about our AWS RDS and database consulting services.
Frequently Asked Questions
Is Amazon DocumentDB the same as MongoDB?
No. Amazon DocumentDB implements a subset of the MongoDB 4.0 and 5.0 wire protocol, which means most MongoDB drivers and tools can connect to it. However, DocumentDB is a purpose-built AWS service — not MongoDB under the hood. It has documented gaps: limited change streams, partial $lookup support, no full-text search (use Amazon OpenSearch instead), and missing aggregation pipeline operators. For simple CRUD-heavy workloads the compatibility is sufficient; for feature-intensive applications it is not.
Can I migrate from MongoDB Atlas to DocumentDB?
Yes. The recommended path is AWS Database Migration Service (DMS), which supports MongoDB as a source and DocumentDB as a target. Before committing to the migration, audit your application code for any aggregation operators, change stream usage, or text search queries — these may need reworking. Run the DocumentDB compatibility checker on your queries before you start.
What are the limitations of Amazon DocumentDB?
The most significant limitations: no full-text search (Atlas Search uses Lucene; DocumentDB has none — use Amazon OpenSearch alongside DocumentDB instead), limited change stream support (only available at the collection level with restrictions), partial $lookup (no uncorrelated subqueries), and missing aggregation operators including $unionWith, $accumulator, and $function. DocumentDB also lags behind MongoDB version releases — it supports MongoDB 4.0 and 5.0 wire protocols but does not track upstream MongoDB feature releases.
Is DocumentDB cheaper than MongoDB Atlas?
It depends on your I/O patterns. DocumentDB uses an unbundled pricing model: you pay separately for instance hours, storage ($0.10/GB-month), and I/Os ($0.20/million). Atlas bundles everything into the instance price. At low I/O volumes, DocumentDB can be cheaper. At high I/O volumes (write-heavy workloads), the per-I/O charges can exceed Atlas pricing. Always model your expected I/O before assuming DocumentDB is cheaper.
Does DocumentDB support MongoDB 5.0?
DocumentDB supports the MongoDB 5.0 wire protocol for compatibility purposes, but this does not mean it supports all MongoDB 5.0 features. Specific 5.0 features like time series collections and window functions in aggregation pipelines are not available in DocumentDB. Check the AWS DocumentDB compatibility matrix for the specific features your application uses before migrating.
Need Help Choosing the Right Cloud Platform?
Our AWS-certified architects help you evaluate cloud platforms based on your specific requirements, workloads, and business goals.
