Inlining or linking is the most common problem I encounter when designing a document structure in the NoSQL world.
In an embedded relationship, child objects were embedded in the parent document. In reference relationships, child entities in separate documents and their parent objects in another document, basically having two (or more) types of documents.
There is no single relationship pattern suitable for everyone. The approach you should use depends on what retrievals and updates should be performed for the data being developed.
1. Do you need to get all the child objects together with the parent objects? If so, use the inline relationship.
2. Does your use case allow you to extract objects separately? In this case, use a relationship template.
In most cases, when I worked, I used the relationship pattern. For example: social graph (profiles with relationship tree), proximity points (proximity search based on GeoJSON), classified listing, etc.
A relationship template is also easier to update and maintain since objects are stored in separate documents.
source share