0
0
MongoDBquery~5 mins

Embedding vs referencing decision in MongoDB - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is embedding in MongoDB?
Embedding means storing related data inside a single document as nested objects or arrays. It keeps related information together in one place.
Click to reveal answer
beginner
What is referencing in MongoDB?
Referencing means storing related data in separate documents and linking them using unique IDs. It keeps data separate but connected.
Click to reveal answer
intermediate
When should you choose embedding over referencing?
Choose embedding when related data is mostly read together, changes rarely, and the data size stays small enough to fit in one document.
Click to reveal answer
intermediate
When is referencing a better choice than embedding?
Use referencing when related data changes often, is large, or is shared across many documents to avoid duplication and keep data consistent.
Click to reveal answer
advanced
What is a key trade-off between embedding and referencing?
Embedding improves read speed by keeping data together but can cause large documents. Referencing keeps data small and consistent but needs extra queries to join data.
Click to reveal answer
Which MongoDB design stores related data inside the same document?
ASharding
BReferencing
CIndexing
DEmbedding
When should you prefer referencing over embedding?
AWhen related data changes frequently and is shared
BWhen related data is small and read together
CWhen you want faster reads with no extra queries
DWhen you want to avoid using unique IDs
What is a downside of embedding large related data?
AData is duplicated
BData becomes inconsistent
CDocuments become too large
DRequires multiple queries
Which design requires extra queries to get related data?
AEmbedding
BReferencing
CDenormalization
DAggregation
Embedding is best when:
AData is mostly read together and small
BData is large and shared
CData changes frequently
DYou want to avoid nested documents
Explain the main differences between embedding and referencing in MongoDB.
Think about how data is stored and accessed.
You got /4 concepts.
    Describe a scenario where embedding is better than referencing and why.
    Imagine a blog post with comments stored inside it.
    You got /4 concepts.