Database Reference
In-Depth Information
Two more points on embedding versus referencing:
If some of these five factors apply but others don't, the best option is to test both
ways (embed and reference) and go with the one that gives the best results, where
results include retrieval performance, ease of data updates, and storage efficien-
cies. Because we are working without predefined schemas, it is a lot easier to test
in MongoDB than in a relational database environment.
MongoDB imposes a size limit on a single document of 16 MB. It is very unlikely
the size factor will influence your decision as to whether to embed or reference, as
this is a huge amount of space (e.g. 120 million tweets), and therefore this factor
rarely becomes a decision point. In addition, MongoDB arrays that grow very large
tend to perform poorly even when indexed. If a set of values or sub-documents will
grow significantly over time, consider referencing over embedding to avoid this
performance penalty. [5]
EXERCISE 7: Embed or Reference
Below are two scenarios with accompanying data models. Based on the scenario and the
sample MongoDB document, decide whether you would embed or reference. Please see
Appendix A for my responses.
Search WWH ::




Custom Search