Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8089

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Aggregation Framework
    • 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 }
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            scotthernandez Scott Hernandez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: