[SERVER-8089] $unwind should error if embedded document field is specified via dot-notation Created: 06/Jan/13  Updated: 20/May/15  Resolved: 20/May/15

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

Type: Bug Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 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 }
 


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