Skip to content
Browse files

minor fix for exhaust

  • Loading branch information...
1 parent 23cd116 commit 245d0ccd4fea4884fde58bb7f1dd6bdc33f45a90 @christkv christkv committed
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/mongodb/connection/server.js
  2. +1 −1 lib/mongodb/cursor.js
View
2 lib/mongodb/connection/server.js
@@ -286,7 +286,7 @@ Server.prototype.connect = function(dbInstance, options, callback) {
}
// The command executed another request, log the handler again under that request id
- if(mongoReply.requestId > 0 && mongoReply.cursorId.toString() != "0") {
+ if(mongoReply.requestId > 0 && mongoReply.cursorId.toString() != "0" && callbackInfo.info && callbackInfo.info.exhaust) {
dbInstance._reRegisterHandler(mongoReply.requestId, callbackInfo);
}
View
2 lib/mongodb/cursor.js
@@ -143,7 +143,7 @@ Cursor.prototype.toArray = function(callback) {
this.each(function(err, item) {
if(err != null) return callback(err, null);
- if(item != null) {
+ if(item != null && Array.isArray(items)) {
items.push(item);
} else {
var resultItems = items;

0 comments on commit 245d0cc

Please sign in to comment.
Something went wrong with that request. Please try again.