JSON document stores: MongoDB, CouchDB and Couchbase.
A document database stores each record as a self-describing JSON (or BSON) document rather than as a row spread across normalized tables. Related data that is read together, such as an order and its line items, lives inside one document, so a single key lookup returns everything the application needs. The three databases in this section all follow that model but make very different choices about consistency, replication, querying, and caching.
Embedding trades write-time duplication for read-time simplicity. It works best when the access pattern is known and documents stay bounded in size; data that is shared across many documents or grows without limit is usually referenced by id instead. Schemas are flexible, so two documents in the same collection can carry different fields, which helps with evolving products but moves validation into the application or into optional schema rules.
MongoDB uses replica sets with a single primary per shard, a rich query language and aggregation pipeline, secondary indexes, and multi-document transactions. CouchDB exposes everything over HTTP and JSON, uses multi-version concurrency control with revision ids, and is built around multi-master replication that tolerates offline peers and resolves conflicts deterministically. Couchbase grew from Memcached and CouchDB: it keeps a managed in-memory cache in front of storage for low-latency key-value access and adds SQL++ (N1QL) queries, full-text search, and analytics services that can be scaled independently.
| Need | MongoDB | CouchDB | Couchbase |
|---|---|---|---|
| Ad hoc queries and aggregations | Strong | Limited (views, Mango) | Strong (SQL++) |
| Offline-first, multi-master sync | Not the design goal | Core feature | Via mobile sync gateway |
| Sub-millisecond key-value reads | Good | Moderate | Core feature (memory-first) |
| Multi-document transactions | Yes | No | Yes |
| Operational simplicity | Managed options widely available | Single HTTP service | More services to size |
Pick MongoDB as a general-purpose default for application data with varied queries, CouchDB when devices must sync while disconnected, and Couchbase when a large share of traffic is cache-like key access but you also want queries over the same data.
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…
Couchbase is a distributed document database that emerged from the 2011 merger of Membase (built on Memcached) and CouchOne (CouchDB). It combines…
MongoDB is not a traditional key-value store, but it can function similarly in some contexts. MongoDB is a document-based NoSQL database, where each document…