-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
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' } ) );