-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Labels:None
-
ALL
Observed behavior: If a field is passed through to a $project result because it is not excluded, and another field with the same name is specified with an operator expression, the result will contain two (duplicate) copies of the original field and value.
Expected behavior: tbd, possibly the operator expression value could override the existing value
Test
c = db.c; c.drop(); c.save( { a:1 } ); // Since 'b' is explicitly excluded, the a field is included. But 'a' is also a computed field. printjson( c.aggregate( { $project:{ b:0, a:{ $and:[ true ] } } } ) );
Output:
{ "result" : [ { "_id" : ObjectId("4fe4ec9054a435a9c73cdaa5"), "a" : "a", "a" : "a" } ], "ok" : 1 }