-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
For $addFields:
Consider document
{ "_id" : 0, "c" : 1 }
and query
{$addFields: {d: {e: 2}, b: 3, a: {b: 4}}}
For classic, the order of fields in the output document is "c" followed by the added fields in the order specified by the addFields. For CQF, the order of fields in the output document is "c" followed by "b", then "a", then "d".
For computed projection mixed with simple inclusion:
Consider document
{_id: 0, a1: {b1: {c1: 1}}}
and query
{$project: {'a1.b1.c1': 1, a0: {b0: {c0: 'str'}}}}
For classic, the order of fields in the output document is "a1" followed by "a0". For CQF, the order of fields in the output document is "a0" followed by "a1". Something very similar happens with only computed projections (i.e., not mixed with simple inclusion)-- CQF orders the fields alphabetically, while classic orders them according to the projection spec.
Filed as one ticket because I think the root cause is similar.
- related to
-
SERVER-70234 [CQF] Order of fields in output documents of simple inclusion projection queries is not the same in CQF vs SBE
- Closed