Absorbing N in a M:N relationship

人走茶凉 提交于 2021-01-29 03:44:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!