Database Reference
In-Depth Information
STEP 1: EMBED OR REFERENCE
MongoDB resolves relationships in one of two ways: embed or reference. Recall the top
five reasons for embedding over referencing from Chapter 7 :
1Requirements state that data from the related entities are frequently queried togeth-
er.
2The child in the relationship is a dependent entity.
3There is a one-to-one relationship between the two entities.
4The related entities have similar volatility.
1The entity you are considering embedding is not a key entity.
With these five reasons in mind, we can take a pencil or marker and group entities together
into collections:
Search WWH ::




Custom Search