DocumentDB is AWS's homegrown database that speaks MongoDB but thinks differently. Launched in 2019 after AWS got tired of paying MongoDB licensing fees - basically their "we'll build our own MongoDB, with blackjack and auto-scaling" solution. Classic AWS move, honestly.
Here's the thing - it's not actually MongoDB, no matter what the marketing says. It's Amazon's custom database engine that happens to understand some MongoDB queries when it feels like it. Think of it like a really sophisticated translator that usually gets the meaning right, but sometimes completely fucks up the nuance and you end up ordering fish instead of chicken. And then arguing with the waiter about why your chicken tastes fishy.
The Architecture Story
The clever part is how AWS separated compute from storage - something MongoDB didn't figure out until much later. Your app talks to compute instances, but all the data lives in a shared storage layer that auto-replicates across three availability zones.
- Primary Instance: Where your writes go (and reads if you want)
- Up to 15 Read Replicas: All share the same storage, so no data copying bullshit
- Cluster Volume: The magic sauce - grows from 10GB to 128TB automatically
This means adding a read replica takes minutes, not hours of copying data around. Pretty neat engineering, honestly.
The "MongoDB Compatible" Reality Check
DocumentDB claims compatibility with MongoDB 3.6, 4.0, and 5.0 APIs. In practice, your basic CRUD operations work fine, MongoDB Compass connects without issue, and most drivers just work.
But here's where you get fucked:
- Multi-document transactions? Works in 4.0+ but didn't exist in 3.6. Half our legacy shit still runs on 3.6 clusters, so good luck with that. And even in 4.0+, the transaction performance is... questionable.
- Advanced aggregation pipelines? Hit or miss. Some work great, others timeout mysteriously.
- Change streams? Work differently and have weird edge cases.
- GridFS? Forget about it.
- Full-text search? Not the MongoDB way - you'll need OpenSearch.
I've seen teams spend fucking forever debugging why their perfectly working MongoDB aggregation pipeline runs like absolute shit in DocumentDB, only to discover it's hitting completely different optimization paths that make no goddamn sense. Had this one team - took them like a month, maybe six weeks? Honestly felt like longer - trying to figure out why this query that was blazing fast in MongoDB suddenly turned into molasses in DocumentDB. Something like 50ms to... I don't know, 8 seconds? Maybe 15? Point is, it was way slower and we never figured out exactly why because DocumentDB's optimizer is basically a different animal that speaks its own weird dialect of performance.
Migration War Stories
Companies switching from self-managed MongoDB usually love not dealing with replica set configuration and automatic failover. The ops team definitely sleeps better.
But the dev team? They discover that "compatible" doesn't mean "identical" when their integration tests start failing in mysterious ways that make no fucking sense. Had this one client - we migrated their e-commerce platform and it was a complete shitshow. Took us like 6 weeks, maybe 8, just to fix the broken aggregations, and then another month trying to explain to the CEO why features that worked perfectly before suddenly didn't work anymore. Those were some really fun meetings. And by fun I mean I wanted to hide under my desk.
Another team migrated their analytics pipeline and their daily reports went from... I think it was like 5 minutes to a couple hours. Maybe three hours? Could've been longer, honestly. Same fucking data, same queries, completely different performance that made zero sense. We spent weeks trying to optimize it, ended up rewriting most of their aggregation logic from scratch. Still not sure we got it right, but the client ran out of budget to keep trying.
Pro tip: that "seamless migration" marketing is complete bullshit designed to get you locked in. Whatever time you think you need, triple it. Actually, maybe quadruple it if you're feeling optimistic. Or just multiply by 10 and save yourself the surprise.