@sargonpiraev

Document database

Created 1 min readseed · 1/5#database

A document database stores data as documents, usually JSON-like objects grouped into collections.

The core idea is that related data can live together in one document instead of being split across many normalized tables.

Example

{
  "id": "user_1",
  "email": "sargon@example.com",
  "profile": {
    "name": "Sargon",
    "city": "Tokyo"
  }
}

The document can contain nested fields and arrays.

What it is good for

Document databases are useful when the application works with:

  • flexible schemas,
  • nested objects,
  • content-like records,
  • rapidly changing product data,
  • reads that usually fetch a whole object at once.

Tradeoff

They reduce friction when the shape of data changes, but relationships, cross-document consistency, and complex joins can become harder than in a relational database.

Theory that matters here

Document databases revolve around document shape, embedding versus referencing, collection-level indexes, schema flexibility, denormalization, and consistency across related documents.

Implementations

No dedicated implementation notes yet. Common systems in this category include MongoDB, CouchDB, and document-oriented modes in broader database products.