[SERVER-6269] DocumentSourceUnwind does not implement the DocumentSource iterator interface correctly Created: 01/Jul/12  Updated: 11/Jul/16  Resolved: 13/Jul/12

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 2.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Aaron Staple
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

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 } ) );



 Comments   
Comment by auto [ 22/Jul/13 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: DocumentSourceCursor should be limit-aware

Follow-up to SERVER-6269 to prevent fetching more documents into a batch
than needed.
Branch: master
https://github.com/mongodb/mongo/commit/6f1068dca58b4f51bf8859c98bba6fc28b10bdea

Comment by auto [ 13/Jul/12 ]

Author:

{u'date': u'2012-07-13T14:57:59-07:00', u'email': u'aaron@10gen.com', u'name': u'Aaron'}

Message: SERVER-6269 SERVER-6131 Reorganize DocumentSourceUnwind so that it iterates properly and omits documents lacking values to unwind.
Branch: master
https://github.com/mongodb/mongo/commit/0da867190d44c77ddf5ffd468c0c0028cd9e653f

Generated at Thu Feb 08 03:11:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.