Repaso
Español
Databases & SQLIntermediateDB-14

Which scenario most favors a document store (e.g. MongoDB) over a relational DB?

Options

  1. A banking ledger with strict multi-table transactions
  2. Flexible nested records read as a whole, with varying schema (Correct option)
  3. Heavy ad-hoc reporting that joins many tables
  4. Strong referential integrity between entities

Answer

Flexible, nested per-record data read as a whole, with schema varying across records

Why

Relational databases (PostgreSQL, MySQL) shine with structured data, joins between tables, constraints and transactions.

Document stores keep each record as a JSON-like document, good when data is naturally nested, read as one piece, and its shape varies (e.g. product catalogs with different attributes per category).

Many companies use both.

Remember

Relational for relations and transactions; documents for flexible nested data.

Key terms

Practice this question in Repaso