AlgoViz

Document database

easy 25 min

A document database stores each thing as one self-describing document, such as a JSON object with nested objects and lists.

Where it shows up

The same pattern appears across everyday software.

  • Product catalogues

    A lamp has watts and a shirt has sizes. One polymorphic collection holds both, and the product page reads one document.

  • Content management

    An article is a tree of blocks: headings, pictures, quotes. It is written and read as a whole.

  • Mobile app backends

    A user profile with settings and devices maps directly to the object in the app, and new app versions add fields.

  • Offline apps

    CouchDB and PouchDB keep a copy on the device and synchronise when the network is back, for example for field workers.

  • Sensor data

    Devices of many models send different readings. Buckets keep the number of documents small. Large fleets often use a time-series store.

  • Order snapshots

    An order embeds the address and prices as they were. Later changes to the customer must not rewrite history.