[SERVER-6184] mixing nested and dotted $project ExpressionObjects produces inconsistent results and assertions in some cases Created: 22/Jun/12  Updated: 29/Aug/12  Resolved: 20/Jul/12

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 2.2.0-rc1

Type: Improvement Priority: Major - P3
Reporter: Aaron Staple Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-6206 need a policy for incompatible types ... Closed
Participants:

 Description   

Observed behavior: see test below
Expected behavior: tbd (either honor all inclusion specifications or assert consistently)

c = db.c;
c.drop();
 
c.save( { a:'foo', b:{ c:'bar' } } );
 
// Only the b:a inclusion is applied.
printjson( c.aggregate( { $project:{ b:{ a:1 }, 'b.c':1 } } ) );
// Reversing the $project fields triggers an assertion.
printjson( c.aggregate( { $project:{ 'b.c':1, b:{ a:1 } } } ) );



 Comments   
Comment by auto [ 20/Jul/12 ]

Author:

{u'date': u'2012-07-14T12:04:12-07:00', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}

Message: Rewrite ExpressionObject

The main difference between this version and the old is that the following
three $pipelines will produce the same output (SERVER-6468):

{'a.b': 1}

// classic inclusion
{a:

{b: 1}

// nested inclusion

{'a.b': '$a.b'}

// dotted FieldPathExpression
{a:

{b: '$a.b'}

// nested FieldPathExpression

Additionally support for exclusion of fields other than _id has been
removed for 2.2 (SERVER-6361)

Other related bugs:
SERVER-6177 better error for

{a:1, 'a.b':1}

SERVER-6181 support for computed _id
SERVER-6184 support {'a.b': 1, a:{c:1}} in either order

Remaining TODOs:
Re-enable the isSimple() method
See if this can be used more directly by $group to support nested fields (SERVER-6198)

Disabled test for SERVER-5369 because it depends on ability to exclude
arbitrary fields.
Branch: master
https://github.com/mongodb/mongo/commit/ec18db98680d31b120350ad45d5f74095125e9a5

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