[SERVER-11833] Projected field order different under new query framework Created: 22/Nov/13  Updated: 09/Jul/16  Resolved: 23/Nov/13

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

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: hari.khalsa@10gen.com
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-11711 Make agg use new query framework Closed
Related
related to SERVER-6293 Index only query fills in missing val... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

It used to be based on document field order, but is now based on the order in the projection spec.

> db.order.drop()
true
> db.order.insert({_id:1, first:1, second:1})
{ "ok" : 1, "n" : 1 }
> db.order.findOne({}, {second:1, first:1})
{ "_id" : 1, "second" : 1, "first" : 1 }
 
// Old query system
> db.adminCommand({setParameter:1, newQueryFrameworkEnabled: false})
{ "was" : true, "ok" : 1 }
> db.order.findOne({}, {second:1, first:1})
{ "_id" : 1, "first" : 1, "second" : 1 }



 Comments   
Comment by Githook User [ 26/Nov/13 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-11711 Make aggregation/testall.js not depend on document order

Needed to make tests pass with agg on top of new query framework. The order of fields returned by
the new query framework is undefined due to SERVER-11833.
Branch: master
https://github.com/mongodb/mongo/commit/a2cf5a59b7e6abe9a481230b3ad9c5fc3b257d8e

Comment by Eliot Horowitz (Inactive) [ 23/Nov/13 ]

New behavior is good, but needs to be documented as such.

Comment by Andy Schwerin [ 22/Nov/13 ]

Order in the projection spec makes sense to me – I'm describing the document I want produced.

Comment by Mathias Stearn [ 22/Nov/13 ]

Correct. SERVER-6293 is a related issue with covered indexes that shows this exact issue.

Comment by hari.khalsa@10gen.com [ 22/Nov/13 ]

If the projection is covered, we don't know the doc order. Unless I'm missing something, we only talk about the projected field order as dependent on the doc order if the projection is NOT covered...

Generated at Thu Feb 08 03:26:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.