>_devkit
mongodb-production
skills/mongodb-production/

references/sources.md

Sources and further reading

Cross-checked against the official manual plus the following. Where guidance conflicted, the MongoDB documentation won.

Data modeling

Multi-tenancy

The index-ceiling caution for database-per-tenant comes from the Atlas guidance above, which puts the practical limit in the low thousands of databases.

Indexing and scaling

Security

Which claims here are opinion

Worth arguing with, because they are judgement rather than documentation:

  • Shared collections as the default for a consultancy. Defensible for a

portfolio of similar apps; the wrong call if most clients are regulated enterprises who will demand isolation in the contract.

  • Do not shard early. Strongly held and occasionally wrong. If a workload is

known to be write-saturating from day one, designing the shard key up front is cheaper than resharding later.

  • 404 rather than 403 for another tenant's object. A deliberate trade of

debuggability for a smaller information leak.

  • Do not mirror _id into a separate id field. Common in practice and

usually a habit carried from SQL. The cost is a second unique index per collection.

  • Keep documents under about 100KB. A rule of thumb, not a documented limit.

The real limit is 16MB and the real constraint is whether the working set fits in RAM.

  • Transactions are a smell if you need them everywhere. True for

document-oriented modeling, and unhelpful if the domain is genuinely relational, in which case the honest answer may be that this data belongs in Postgres.