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?
✗ Incorrect
Embedding stores related data inside the same document as nested objects or arrays.
When should you prefer referencing over embedding?
✗ Incorrect
Referencing is better when related data changes often or is shared to avoid duplication.
What is a downside of embedding large related data?
✗ Incorrect
Embedding large data can make documents too big, which affects performance.
Which design requires extra queries to get related data?
✗ Incorrect
Referencing stores data separately, so you need extra queries to join related data.
Embedding is best when:
✗ Incorrect
Embedding works well when related data is small and usually read together.
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.