Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
-
ALL
Description
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 } |
|
|