What this thread does
Write one repository ADR that ties the Postgres-or-MongoDB decision to concrete queries, invariants, operating costs and a measurable reason to revisit it.
Do first: create the service decision file in docs/adr/
1. Follow the repository's existing ADR directory and format; otherwise use docs/adr/. Start with proposed status and name a human decision owner. 2. List representative reads, writes, relationships and correctness requirements. State expected data volume and latency goals as requirements, not measured results. Name who operates backups and restores. 3. Compare both data models for those operations. Attach official references and separate actual measurements from estimates. Reject an option because of a workload tradeoff, not because “SQL cannot store JSON” or “MongoDB has no transactions.” 4. Fill the example below with the team's facts. Review the reasons and consequences with the owner before changing status to accepted. Link the ADR from the service README and agent instructions so future changes encounter the decision. 5. If new facts overturn it, write a superseding ADR and link both records. Keep the old rationale; do not rewrite history to make the old decision look inevitable.
Worked ADR outline
This is an illustrative recommendation for an order service, not a report about a deployed system. Adapt the structure from the MADR project.
# Store order-service records in Postgres
## Status and owner
Proposed; owner <team/person>; decision date <date>.
## Context and decision drivers
Orders reference customers and products. We require enforced relational
integrity and reporting across those entities. Product metadata varies.
Target volume <requirement>; target p95 <requirement>.
Backup/restore owner <owner>; recovery objectives <requirements>.
## Considered options
Postgres with relational tables and JSONB metadata.
MongoDB with embedded order snapshots and referenced shared entities.
## Decision outcome
Choose Postgres if the stated relational/reporting requirements hold.
Foreign keys model shared identities; JSONB covers variable metadata.
MongoDB remains viable when bounded document aggregates dominate reads
and their denormalization/update contract is acceptable.
## Evidence and costs
Official references <links and checked date>.
Measured queries, dataset, indexes and hardware <not yet measured>.
Hosting, backup, restore, support and engineering estimates <not yet estimated>.
Record actual stable server/driver versions used by an evaluation.
## Consequences
We accept schema-migration work and index maintenance.
We avoid duplicating shared entity data as the default write model.
Variable metadata still needs validation and an index strategy.
## Confirmation and revisit
Owner <person> reviews query plans and a restore rehearsal before acceptance.
Revisit if <named workload change> or <agreed latency/cost threshold> occurs.
A future decision supersedes this record and links back to it.
MADR's own format decision shows context, considered options and outcome. The workload, confirmation and revisit content above is an authored adaptation.
Option facts and operating boundaries — checked 2026-10-28
| Option and purpose | Wins when | Loses when | Cost/limit facts and pick-this-if line |
|---|---|---|---|
| Postgres for relational records and mixed structured/JSON data | Shared entities, constraints and cross-entity reporting are central | Your dominant access pattern gains enough from a document aggregate to justify a different model | PostgreSQL licence permits use without a licence fee; hosting and operations remain costs. Pick this if relationships and correctness constraints drive the service. |
| MongoDB for document aggregates | Related data is read together and fits a deliberately bounded aggregate | Frequent independent updates to duplicated/shared data complicate the model | Self-managed Community use is governed by SSPL and its FAQ; managed Atlas is a separate commercial offering. No deployment quote is established here. Pick this if the document model wins on your actual operations. |
Postgres supports foreign-key and other constraints and indexed JSONB. MongoDB's modelling guide describes embedding versus references; its transaction docs document single-document atomicity and multi-document transactions. Those capabilities do not establish a performance winner. Record the deployment topology and configuration used for any comparison.
Recommendation by constraint
Solo developer or small team already operating Postgres: consider Postgres if it meets the documented workload and operating constraints. A team already operating MongoDB with bounded document aggregates can reasonably keep MongoDB. Enterprise: prefer the approved operational platform that satisfies the invariants; document any exception with restore ownership, support requirements and representative measurements. Team size alone is not a database requirement.
Public evidence
Evidence: none found for a public Postgres-versus-MongoDB ADR with a reproducible evaluation matching this order-service example. MADR establishes a recording format; vendor docs establish capabilities. Neither validates the illustrative decision for your workload.
Prompt for the agent
Read our existing ADR conventions. Draft a proposed Postgres-versus-MongoDB ADR for this service using our actual queries and invariants. Mark missing facts explicitly. Include rejected alternatives, costs, an owner, confirmation criteria and a revisit trigger. Do not invent benchmarks, accept the decision or migrate data.
Mistakes and Limits
Do not accept a decision with placeholder measurements presented as results. Do not erase rejected alternatives or use “scales better” without a workload and evidence. No database was installed, benchmarked or priced for a deployment here. This records a decision; it is not a data migration, a server-version recommendation or a universal database ranking.
Started from a post by @MADR contributors, packaged by the editor. Original post