DDR Data Science Interview Practice Test

Access More Questions
Which statement correctly contrasts embedding and referencing in MongoDB?
Correct Answer:
Embedding stores related data as a nested document; Referencing stores related data in a separate collection
Explanation:
Embedding and referencing describe how related data is modeled in MongoDB. The correct statement is that embedding stores related data as a nested document, while referencing stores related data in a separate collection. Embedding puts the related data inside the parent document, which makes reads fast and atomic for the whole object and is great for tightly linked, one-to-few relationships. But it can blow up document size and create duplication if the related data is large or needs to be updated independently. Referencing keeps related data in separate documents across collections and uses identifiers to link them, which avoids duplication and supports more flexible, many-to-many relationships, but reads require extra queries or a lookup stage to assemble the full picture. The other statements misstate where the data lives: embedding is not in a separate collection, and referencing is not a nested document or stored in the same document.

Access more questions from this quiz

Continue to DDR Data Science Interview Practice Test for more practice questions and the full quiz experience.

Access More Questions