Put them all into a single box: {top:1, bottom:0, left:0, right:1}
style field as the two approaches are functionally equivalent but this way would let you more easily include/exclude the group of fields in projections when needed by just referencing box: 1
or box: 0
.
Grouping information in Mongodb
-
30-05-2022 - |
Pregunta
A simple question. Suppose I have 4 numbers that describe a box. Should I add them in the form of: box:{top, bottom, left, right} or keep them as 4 separate fields of the document?
I would appreciate a reason to, or not to, choose or not choose a particular one. Bare in mind this will used everywhere. Unless I shouldn't !?
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow