Skip to content

Commit 9244b17

Browse files
authoredJul 15, 2021
fix(NODE-1843): bulk operations ignoring provided sessions [PORT] (#2898)
1 parent 6ee945e commit 9244b17

File tree

4 files changed

+613
-633
lines changed

4 files changed

+613
-633
lines changed
 

‎lib/bulk/common.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1176,8 +1176,11 @@ class BulkOperationBase {
11761176
* @param {function} callback
11771177
*/
11781178
bulkExecute(_writeConcern, options, callback) {
1179-
if (typeof options === 'function') (callback = options), (options = {});
1180-
options = options || {};
1179+
if (typeof options === 'function') {
1180+
callback = options;
1181+
}
1182+
1183+
const finalOptions = Object.assign({}, this.s.options, options);
11811184

11821185
if (typeof _writeConcern === 'function') {
11831186
callback = _writeConcern;
@@ -1203,7 +1206,7 @@ class BulkOperationBase {
12031206
const emptyBatchError = toError('Invalid Operation, no operations specified');
12041207
return this._handleEarlyError(emptyBatchError, callback);
12051208
}
1206-
return { options, callback };
1209+
return { options: finalOptions, callback };
12071210
}
12081211

12091212
/**

0 commit comments

Comments
 (0)
Please sign in to comment.