File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -349,8 +349,10 @@ private void init( Response res ){
349
349
}
350
350
351
351
public DBObject next (){
352
- if ( _cur .hasNext () )
352
+ if ( _cur .hasNext () ) {
353
+ _numSeen ++;
353
354
return _cur .next ();
355
+ }
354
356
355
357
if ( ! _curResult .hasGetMore ( _options ) )
356
358
throw new RuntimeException ( "no more" );
@@ -380,7 +382,7 @@ private void _advance(){
380
382
381
383
m .writeInt ( 0 );
382
384
m .writeCString ( _collection ._fullNameSpace );
383
- m .writeInt ( _numToReturn ); // num to return
385
+ m .writeInt ( _numToReturn - _numSeen ); // num to return
384
386
m .writeLong ( _curResult .cursor () );
385
387
386
388
Response res = _connector .call ( DBApiLayer .this , _collection , m , _host );
@@ -393,11 +395,11 @@ public void remove(){
393
395
}
394
396
395
397
public int getNumberToReturn (){
396
- return _numToReturn ;
398
+ return _numToReturn ;
397
399
}
398
-
400
+
399
401
public void setNumberToReturn (int num ){
400
- _numToReturn = num ;
402
+ _numToReturn = num ;
401
403
}
402
404
403
405
public String toString (){
@@ -469,6 +471,8 @@ public ServerAddress getServerAddress() {
469
471
private long _totalBytes = 0 ;
470
472
private int _numGetMores = 0 ;
471
473
private List <Integer > _sizes = new ArrayList <Integer >();
474
+ private int _numSeen = 0 ;
475
+
472
476
} // class Result
473
477
474
478
static class DeadCursor {
You can’t perform that action at this time.
0 commit comments