Skip to content

Commit

Permalink
fix(NODE-1843): bulk operations ignoring provided sessions [PORT] (#2898
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nbbeeken committed Jul 15, 2021
1 parent 6ee945e commit 9244b17
Show file tree
Hide file tree
Showing 4 changed files with 613 additions and 633 deletions.
9 changes: 6 additions & 3 deletions lib/bulk/common.js
Expand Up @@ -1176,8 +1176,11 @@ class BulkOperationBase {
* @param {function} callback
*/
bulkExecute(_writeConcern, options, callback) {
if (typeof options === 'function') (callback = options), (options = {});
options = options || {};
if (typeof options === 'function') {
callback = options;
}

const finalOptions = Object.assign({}, this.s.options, options);

if (typeof _writeConcern === 'function') {
callback = _writeConcern;
Expand All @@ -1203,7 +1206,7 @@ class BulkOperationBase {
const emptyBatchError = toError('Invalid Operation, no operations specified');
return this._handleEarlyError(emptyBatchError, callback);
}
return { options, callback };
return { options: finalOptions, callback };
}

/**
Expand Down

0 comments on commit 9244b17

Please sign in to comment.