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 ){
349349 }
350350
351351 public DBObject next (){
352- if ( _cur .hasNext () )
352+ if ( _cur .hasNext () ) {
353+ _numSeen ++;
353354 return _cur .next ();
355+ }
354356
355357 if ( ! _curResult .hasGetMore ( _options ) )
356358 throw new RuntimeException ( "no more" );
@@ -380,7 +382,7 @@ private void _advance(){
380382
381383 m .writeInt ( 0 );
382384 m .writeCString ( _collection ._fullNameSpace );
383- m .writeInt ( _numToReturn ); // num to return
385+ m .writeInt ( _numToReturn - _numSeen ); // num to return
384386 m .writeLong ( _curResult .cursor () );
385387
386388 Response res = _connector .call ( DBApiLayer .this , _collection , m , _host );
@@ -393,11 +395,11 @@ public void remove(){
393395 }
394396
395397 public int getNumberToReturn (){
396- return _numToReturn ;
398+ return _numToReturn ;
397399 }
398-
400+
399401 public void setNumberToReturn (int num ){
400- _numToReturn = num ;
402+ _numToReturn = num ;
401403 }
402404
403405 public String toString (){
@@ -469,6 +471,8 @@ public ServerAddress getServerAddress() {
469471 private long _totalBytes = 0 ;
470472 private int _numGetMores = 0 ;
471473 private List <Integer > _sizes = new ArrayList <Integer >();
474+ private int _numSeen = 0 ;
475+
472476 } // class Result
473477
474478 static class DeadCursor {
You can’t perform that action at this time.
0 commit comments