mongodb best practice: nesting

后端 未结 4 734
盖世英雄少女心
盖世英雄少女心 2020-12-30 08:06

Is this example of nesting generally accepted as good or bad practice (and why)?

A collection called users:

user
    basic
        name : value
              


        
4条回答
  •  离开以前
    2020-12-30 08:19

    That is acceptable practice. There are some problems with nesting an array inside of an array. See SERVER-831 for one example. However, you don't seem to be using arrays in your collection at all.

    Conversely, if you were to break this up into multiple collections, you would have to deal with a lack of transactions and the resulting race conditions in your data access code.

提交回复
热议问题