Document Model

Summary: A data model where data is stored in self-contained, tree-structured documents (typically JSON or BSON).

Sources: raw/chapter2

Last updated: 2026-04-15


The document model gained popularity with the nosql movement as an alternative to the relational-model, particularly for use cases where data has a naturally hierarchical or tree-like structure (source: chapter2, p. 31).

Key Characteristics

  • Tree Structure: Documents represent a tree structure of one-to-many relationships explicitly, making them ideal for data that is mostly self-contained (source: chapter2, p. 32).
  • data-locality: Because a document is typically stored as a single continuous string, fetching a record often requires only one disk seek (source: chapter2, p. 41).
  • schema-on-read: The database does not enforce a schema; the application interprets the structure when reading the data, allowing for greater flexibility with heterogeneous data (source: chapter2, p. 39).
  • Weak Join Support: Document databases often have poor support for joins, requiring developers to either denormalize data or perform joins in application code (source: chapter2, p. 34).

When to Use

The document model is a good fit if your data has a document-like structure (one-to-many relationships where the entire tree is loaded at once) (source: chapter2, p. 38). However, it becomes awkward if your data has many many-to-many relationships (source: chapter2, p. 39).