[SERVER-7502] Query's projection does not obey partial inclusion or exclusion of _id Created: 29/Oct/12  Updated: 02/Jan/20  Resolved: 24/Oct/19

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

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: Ian Boros
Resolution: Done Votes: 0
Labels: query-44-grooming, storch
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-29298 certain _id subfield projections retu... Closed
is duplicated by SERVER-23144 dot notation of projections doesn't w... Closed
is duplicated by SERVER-14160 Cannot project subfield of _id Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Sprint: Query 2019-11-04
Participants:

 Description   

> db.a.find()
{ "_id" : { "a" : 1, "b" : 1 }, "v" : 123 }
{ "_id" : { "a" : 1, "b" : 2 }, "v" : 345 }
{ "_id" : { "a" : 2, "b" : 2 }, "v" : 222 }
{ "_id" : { "a" : 2, "b" : 1 }, "v" : 567 }
> db.a.find({}, {'_id.a':1})  // Should only include "_id.a".
{ "_id" : { "a" : 1, "b" : 1 } }
{ "_id" : { "a" : 1, "b" : 2 } }
{ "_id" : { "a" : 2, "b" : 2 } }
{ "_id" : { "a" : 2, "b" : 1 } }
> db.a.find({}, { '_id.b':0})  // Should exclude "_id.b".
{ "_id" : { "a" : 1, "b" : 1 }, "v" : 123 }
{ "_id" : { "a" : 1, "b" : 2 }, "v" : 345 }
{ "_id" : { "a" : 2, "b" : 2 }, "v" : 222 }
{ "_id" : { "a" : 2, "b" : 1 }, "v" : 567 }



 Comments   
Comment by Githook User [ 24/Oct/19 ]

Author:

{'username': 'puppyofkosh', 'email': 'ian.boros@mongodb.com', 'name': 'Ian Boros'}

Message: SERVER-7502 test that partial projection of _id works correctly
Branch: master
https://github.com/mongodb/mongo/commit/6344b4cdc185f2e3438f3f46f35de472820f66a6

Comment by auto [ 06/Nov/12 ]

Author:

{u'date': u'2012-10-29T18:33:34Z', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}

Message: SERVER-7491: Correctly generate projections for subfields of _id

This requires special casing due to SERVER-7502
Branch: v2.2
https://github.com/mongodb/mongo/commit/910a15e0698cac4a078c608d6f5c03f44e5f9e18

Comment by auto [ 05/Nov/12 ]

Author:

{u'date': u'2012-10-29T18:33:34Z', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}

Message: SERVER-7491: Correctly generate projections for subfields of _id

This requires special casing due to SERVER-7502
Branch: master
https://github.com/mongodb/mongo/commit/509199b32dc34f302e1d188a9b35bf7e3a4bd017

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