$unwind should error if embedded document field is specified via dot-notation

XMLWordPrintableJSON

    • 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 }
      
      

            Assignee:
            Unassigned
            Reporter:
            Scott Hernandez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: