MongoDB relationships: embed or reference?

后端 未结 11 2389
夕颜
夕颜 2020-11-21 05:34

I\'m new to MongoDB--coming from a relational database background. I want to design a question structure with some comments, but I don\'t know which relationship to use for

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-21 06:08

    In general, embed is good if you have one-to-one or one-to-many relationships between entities, and reference is good if you have many-to-many relationships.

提交回复
热议问题