Skip to main content

What is an embedded document and when is embedding recommended?

Junior MongoDB
Quick Answer Embedded documents store related data together in one document (address inside a user doc). Recommended when data is accessed together, relationship is one-to-one or one-to-few, and child data doesn't grow unboundedly. Referencing stores the related document's _id and uses $lookup for joins. Use referencing for many-to-many, frequently changing data, or data shared across documents.

Answer

An embedded document stores related data inside a parent document. Embedding improves read performance and is recommended for one-to-few relationships.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice