问题
I am encountering an issue I am trying to wrap my head around. I am using learnmongodbthehardway as a resource to define my options modelling a M:N relationship. According to this link I have two options: One way embedding and Two way embedding.
I’d like to add a third option to this list called absorption. Absorption takes place when it makes no sense to implement one of the entity’s on its own. It might never be queried for example. An example of this can be extracted from the following model:
A taken sample has no meaning without the context that it was taken in a Water_Quality_Test. It will never be queried on its own. In this case it would be better (I think) to absorb the Sample entity into the Water_Quality_Test entity and implement it as an array (in some other cases this could even be an array of objects) held by this entity.
Is my suggestion good or am I missing out on something here and is this already a known solution or a bad solution?
来源:https://stackoverflow.com/questions/57970185/absorbing-n-in-a-mn-relationship