beginnerMongoDB — CRUD, Queries & Aggregation Framework
What is the difference between embedded documents and references in MongoDB?
Embedded (denormalized): Related data nested inside the parent document. Example: user document containing an address subdocument. Pros: single query returns all data; atomic updates on the document; no JOINs. Cons: document grows unboundedly for one-to-many with many items; data duplication. References (normalized): Documents in different collections linked by a reference ID (like a foreign key).
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response