Apache CouchDB
Apache CouchDB is the original document database. Created by Damien Katz (ex-Lotus Notes) in 2005 and donated to the Apache Software Foundation in 2008, CouchDB pioneered JSON-document storage years before MongoDB and shipped one of the first multi-master replication models in any open database. CouchDB is the database that made “offline-first” applications possible — a mobile or browser client can read, write, and synchronize against a master database without ever blocking on the network.
Key Features:
- JSON Documents. Each document is a JSON blob with a stable
_id and a monotonically-increasing _rev for concurrency control.
- HTTP / REST API. Every operation is an HTTP verb —
PUT, GET, DELETE. No driver required; curl works as a client.
- MVCC. Updates produce new revisions instead of overwriting; the conflict-resolution model is exposed to the application.
- Multi-Master Replication. Bidirectional, peer-to-peer replication between any two databases — the foundation for offline-first apps via PouchDB in the browser and Couchbase Lite / Cloudant Sync on mobile.
- MapReduce Views. Define views as JavaScript functions; CouchDB indexes them incrementally and serves queries against them.
- Mango Query Language. Newer JSON-based query DSL similar in spirit to MongoDB’s find syntax.
- Crash-Only Design. Append-only file format; no separate WAL, no “clean shutdown” concept — CouchDB recovers identically from any termination.
CouchDB vs. MongoDB:
- Replication. CouchDB — multi-master, conflict-resolution exposed; ideal for distributed/offline. MongoDB — single-master replica sets with automatic failover.
- Query. CouchDB — views via MapReduce + Mango selector. MongoDB — richer ad-hoc query language and aggregation pipeline.
- API. CouchDB — pure HTTP. MongoDB — binary protocol with language drivers.
- Throughput. MongoDB scales further on raw write throughput; CouchDB’s sweet spot is correctness and replication, not speed.
Use Cases:
- Offline-first mobile and PWA applications — sync on reconnect.
- Distributed systems with intermittent connectivity — field workers, ships, retail point-of-sale.
- Document store where multi-master conflict resolution is part of the application logic, not a bug.
- Single-binary, no-driver-needed deployments where HTTP-as-protocol is a feature.