decide on behavior to $unwind an empty array

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 2.2.0-rc0
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      The documentation says $unwind of an empty array passes through the source document unchanged. There are code comments stating that the behavior is to replace the empty array with a null value when unwinding. The actual behavior appears to be that the array field is removed from the document.

      c = db.c;
      c.drop();
      
      c.save( { a:[] } );
      printjson( c.aggregate( { $unwind:'$a' } ) );
      

            Assignee:
            Aaron Staple (Inactive)
            Reporter:
            Aaron Staple (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: