.NET Architecture & System Design Interview Question #66

What is a document database?

Database Scaling, Partitioning, NoSQL & Data Consistency Mid-Level Intermediate

Quick Interview Answer

A document database stores records as self-contained documents, commonly JSON-like structures. Related data that is normally accessed together can often be stored together in one document.

Detailed Explanation

A document database stores records as self-contained documents, commonly JSON-like structures. Related data that is normally accessed together can often be stored together in one document.

Document databases can support flexible schemas and aggregate-oriented access. Designers still need to consider document size, indexing, update patterns, duplication, transactions, and relationships between aggregates.

Code Example

{
  "orderId": 42,
  "customer": "Asif",
  "items": [
    { "productId": 7, "qty": 2 }
  ]
}