@@ -368,7 +368,7 @@ export class Collection implements OperationParent {
368
368
callback ?: Callback < BulkWriteResult >
369
369
) : Promise < BulkWriteResult > | void {
370
370
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
371
- options = resolveInheritedOptions ( this , options ?? { ordered : true } ) ;
371
+ options = options || { ordered : true } ;
372
372
373
373
if ( ! Array . isArray ( operations ) ) {
374
374
throw new MongoError ( 'operations must be an array of documents' ) ;
@@ -1305,14 +1305,24 @@ export class Collection implements OperationParent {
1305
1305
1306
1306
/** Initiate an Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order. */
1307
1307
initializeUnorderedBulkOp ( options ?: BulkWriteOptions ) : any {
1308
- options = resolveInheritedOptions ( this , options ) ;
1309
- return new UnorderedBulkOperation ( this , options ) ;
1308
+ options = options || { } ;
1309
+ // Give function's options precedence over session options.
1310
+ if ( options . ignoreUndefined == null ) {
1311
+ options . ignoreUndefined = this . bsonOptions . ignoreUndefined ;
1312
+ }
1313
+
1314
+ return new UnorderedBulkOperation ( this , options ?? { } ) ;
1310
1315
}
1311
1316
1312
1317
/** Initiate an In order bulk write operation. Operations will be serially executed in the order they are added, creating a new operation for each switch in types. */
1313
1318
initializeOrderedBulkOp ( options ?: BulkWriteOptions ) : any {
1314
- options = resolveInheritedOptions ( this , options ) ;
1315
- return new OrderedBulkOperation ( this , options ) ;
1319
+ options = options || { } ;
1320
+ // Give function's options precedence over session options.
1321
+ if ( options . ignoreUndefined == null ) {
1322
+ options . ignoreUndefined = this . bsonOptions . ignoreUndefined ;
1323
+ }
1324
+
1325
+ return new OrderedBulkOperation ( this , options ?? { } ) ;
1316
1326
}
1317
1327
1318
1328
/** Get the db scoped logger */
0 commit comments