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 !?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top