Skip to content

Commit

Permalink
fix(change-stream): default to server default batch size
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mbroadst committed Aug 28, 2019
1 parent ae94cb9 commit b3ae4c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/change_stream.js
Expand Up @@ -367,10 +367,9 @@ function createChangeStreamCursor(self, options) {

const pipeline = [{ $changeStream: changeStreamStageOptions }].concat(self.pipeline);
const cursorOptions = applyKnownOptions({}, options, CURSOR_OPTIONS);
const changeStreamOptions = Object.assign({ batchSize: 1 }, options);
const changeStreamCursor = new ChangeStreamCursor(
self.topology,
new AggregateOperation(self.parent, pipeline, changeStreamOptions),
new AggregateOperation(self.parent, pipeline, options),
cursorOptions
);

Expand Down
4 changes: 3 additions & 1 deletion test/functional/change_stream_tests.js
Expand Up @@ -543,7 +543,9 @@ describe('Change Streams', function() {
assert.ifError(err);

var database = client.db('integration_tests');
var changeStream = database.collection('invalidateListeners').watch(pipeline);
var changeStream = database
.collection('invalidateListeners')
.watch(pipeline, { batchSize: 1 });

// Attach first event listener
changeStream.once('change', function(change) {
Expand Down

0 comments on commit b3ae4c5

Please sign in to comment.