[SERVER-70234] [CQF] Order of fields in output documents of simple inclusion projection queries is not the same in CQF vs SBE Created: 05/Oct/22  Updated: 27/Oct/23  Resolved: 24/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Hana Pearlman Assignee: Backlog - Query Optimization
Resolution: Works as Designed Votes: 0
Labels: bonsai-semantic-difference
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-70236 [CQF] Order of fields in output docum... Backlog
Assigned Teams:
Query Optimization
Participants:

 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.


Generated at Thu Feb 08 06:15:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.