Details
-
Task
-
Resolution: Works as Designed
-
Major - P3
-
None
-
None
-
None
-
Query Optimization
Description
Order of fields in output documents of simple inclusion projection queries is not the same in CQF vs SBE.
Consider the following documents:
{ “_id” : 0, “a1" : { “b1” : 1, “c1" : 1 }, “a2” : { “b2" : 1, “c2” : 1 } }
|
{ “_id” : 1, “a2” : { “c2" : 1, “b2” : 1 }, “a1" : { “c1” : 1, “b1" : 1 } }
|
and the query
{$project: {‘a2.b2’: 1, ‘a1.b1’: 1}}
|
SBE orders the fields by the order in which they were included in the projection spec, so in both output docs we see "a2" followed by "a1". CQF orders the fields alphabetically, so in both output docs we see "a1" followed be "a2".
Classic does something else; it maintains the order of the fields in the input document. The classic/SBE difference seemed to be approved.
Attachments
Issue Links
- is related to
-
SERVER-70236 [CQF] Order of fields in output documents of computed projections/addFields changes in CQF
-
- Backlog
-