MongoDB relationships: embed or reference?

后端 未结 11 2638
夕颜
夕颜 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 05:52

    I came across this small presentation while researching this question on my own. I was surprised at how well it was laid out, both the info and the presentation of it.

    http://openmymind.net/Multiple-Collections-Versus-Embedded-Documents

    It summarized:

    As a general rule, if you have a lot of [child documents] or if they are large, a separate collection might be best.

    Smaller and/or fewer documents tend to be a natural fit for embedding.

提交回复
热议问题