Skip to content

Commit b3ae4c5

Browse files
committed
fix(change-stream): default to server default batch size
We should not default our change streams to a batch size of one, but rather send no value and accept the server default. NODE-2137
1 parent ae94cb9 commit b3ae4c5

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/change_stream.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,9 @@ function createChangeStreamCursor(self, options) {
367367

368368
const pipeline = [{ $changeStream: changeStreamStageOptions }].concat(self.pipeline);
369369
const cursorOptions = applyKnownOptions({}, options, CURSOR_OPTIONS);
370-
const changeStreamOptions = Object.assign({ batchSize: 1 }, options);
371370
const changeStreamCursor = new ChangeStreamCursor(
372371
self.topology,
373-
new AggregateOperation(self.parent, pipeline, changeStreamOptions),
372+
new AggregateOperation(self.parent, pipeline, options),
374373
cursorOptions
375374
);
376375

test/functional/change_stream_tests.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,9 @@ describe('Change Streams', function() {
543543
assert.ifError(err);
544544

545545
var database = client.db('integration_tests');
546-
var changeStream = database.collection('invalidateListeners').watch(pipeline);
546+
var changeStream = database
547+
.collection('invalidateListeners')
548+
.watch(pipeline, { batchSize: 1 });
547549

548550
// Attach first event listener
549551
changeStream.once('change', function(change) {

0 commit comments

Comments
 (0)