-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
It is easy for users to make a mistake where the $unwind produce no results by using dot-notation into the array (embedded elements):
> db.movies.aggregate( {$match:{"prods.n":/a/}} ,{$unwind:"$prods.n"}, {$group:{_id:"$prods.n"}} )
{ "result" : [ ], "ok" : 1 }
> db.movies.aggregate( {$match:{"prods.n":/a/}} ,{$unwind:"$prods"}, {$group:{_id:"$prods.n"}} )
{ "result" : [ { "_id" : "b" }, { "_id" : "a" } ], "ok" : 1 }