Mongodb's Subdocuments update question?

[
{
_id:001
...
arrs:[{name:"a",score:10},
      {name:"b",score:11},
      {name:"c",score:12},
      {name:"d",score:13}
     ]
}
{
_id:002
...
arrs:[{name:"a",score:11},
      {name:"b",score:12},
      {name:"c",score:13},
      {name:"d",score:14}
     ]
}
...
]

like the documents with embedded arrays above, each arrs is less than 20 in length, but you need to update the name,score. of arrs internal subdocuments more frequently. Whether it is necessary to split the arrs internal sub-document into a separate piece of collection.
this is the suggestion found elsewhere: the smallest unit of
operation had better be Document, rather than SubDocument,. If you often have the need for SubDocument operation, please take it out and put it into another Collection, Refrence these split Document in the original Collection data structure.
I haven"t found this suggestion on the official website yet. Should I split it out?

Sep.27,2021

there is no absolute standard, what to do needs to be weighed against your actual situation. This is also the difficulty of MongoDB data model design, because unlike RDBMS has a paradigm standard, MongoDB model design is based on your needs, weighing the pros and cons of various usage scenarios, and then choose a model with the best benefits. So it is unreasonable to say which is better without any background (so it is impossible to find such advice on the official website).
what is the reason for choosing to put these things in an array in the first place? If there is no connection between these data, it is totally unnecessary to put them together.

Menu