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

DocumentSourceUnwind does not implement the DocumentSource iterator interface correctly

    • ALL

      DocumentSourceUnwind does not advance properly if getCurrent() is not called before advance(). And there may be a problem with eof() if pUnwindValue is set but pUnwinder is exhausted.

      Observed behavior: An incorrect result set may be generated for pipelines involving $unwind, particularly if used in conjunction with $skip.
      Expected behavior: Correct result set.

      Test:

      c = db.c;
      c.drop();
      
      c.save( { a:[ 1, 2 ] } );
      // One result expected, but none returned.                                              
      printjson( c.aggregate( { $unwind:'$a' }, { $skip:1 } ) );
      

            Assignee:
            aaron Aaron Staple
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: