[SERVER-6866] Support dotted field past positional operator with positional operator projection Created: 27/Aug/12  Updated: 06/Dec/22

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

Type: Improvement Priority: Major - P3
Reporter: Aaron Staple Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-6864 positional operator projection inclus... Closed
is related to SERVER-43334 Disallow additional path components a... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

With update the positional operator can be combined with additional fields after the dollar sign, for example 'a.$.b' to indicate the 'b' field within the matched array element. This is not yet supported with positional projections.

Observed behavior: Projecting

{ 'a.$.b':1 }

is equivalent to projecting

{ 'a.$':1 }

.
Expected behavior: Projecting

{ 'a.$.b':1 }

will project only the 'b' field within the matching array element.

Test

c = db.c;
c.drop();
 
c.save( { a:[ { b:10, c:1 }, { b:5, c:1 } ] } );
 
// Update the 'b' field within the matching array element.
c.update( { 'a.b':5 }, { $set:{ 'a.$.b':6 } } );
printjson( c.findOne() );
 
// Projects the entire matching array element.
printjson( c.find( { 'a.b':6 }, { 'a.$':1 } ).toArray() );
 
// Projects the entire matching array element (contrary to expected behavior).
printjson( c.find( { 'a.b':6 }, { 'a.$.b':1 } ).toArray() );
 
// Projects the 'b' fields within all array elements.
printjson( c.find( { 'a.b':6 }, { 'a.b':1 } ).toArray() );



 Comments   
Comment by Aaron Staple [ 27/Aug/12 ]

Provisionally scheduling in planning bucket a.

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