Embedded documents vs. references
coreintermediateEmbedding puts related data directly inside a document; referencing stores just an _id and looks the related document up separately. Embed what is read together and bounded; reference what grows independently or is shared broadly.
Think of it as
Embedding is writing a note directly on the form it belongs to; referencing is writing a case number on the form and keeping the details in a separate file. The note is faster to read together with the form — but if that same note needs to be found from ten other forms too, a shared file referenced by number is easier to keep in sync.
What we're doing: Model the same relationship (book and author) two ways and show why one book-per-author changes the right choice.
- 2
- Embedding is right here — the author data is small, read with the book every time, and not shared.
- 5
- Referencing is right here — the same author document is reused across many books, so embedding would duplicate and desynchronize it.
Why this works: The relationship (book has an author) does not change — what changes is cardinality and sharing. Embedding a value that is actually shared across many parents means every copy has to be updated in lockstep, which referencing avoids by keeping one copy.
Embedding data that is shared across many parent documents
Wrong
Better
What you see: A single author bio update requires a multi-document write across every book by that author, and a missed one leaves stale, inconsistent copies.
Why: Embedding trades a join for duplication — that trade only pays off when the embedded data belongs to one parent. Data genuinely shared across many parents needs one source of truth, which is what a reference provides.
- Embed
- Nested inline, no join
- Read together, bounded
- Owned by one parent
- Reference
- Stores an _id, needs a lookup
- Grows independently or shared
- Has its own lifecycle
Embed or reference — the deciding questions
Together
Remember: Embed data that is read together, bounded and owned by one parent. Reference data that grows independently or is shared across many parents.
See also: document oriented · nested fields and dot notation

