From ad10deef3831c35fa76f7c83e8afcce7a885baa0 Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Tue, 17 Apr 2018 19:35:35 -0400 Subject: [PATCH] fix(aggregte): support user-provided `batchSize` NODE-1415 --- lib/collection.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/collection.js b/lib/collection.js index 94fa7eb36d..b293354de4 100644 --- a/lib/collection.js +++ b/lib/collection.js @@ -2430,7 +2430,8 @@ Collection.prototype.aggregate = function(pipeline, options, callback) { throw toError('cursor options must be an object'); } - options.cursor = options.cursor || { batchSize: 1000 }; + options.cursor = options.cursor || {}; + if (options.batchSize) options.cursor.batchSize = options.batchSize; command.cursor = options.cursor; // promiseLibrary