@@ -7,7 +7,7 @@ import { commandSupportsReadConcern } from '../sessions';
7
7
import { MongoError } from '../error' ;
8
8
import type { Logger } from '../logger' ;
9
9
import type { Server } from '../sdam/server' ;
10
- import { Document , inheritOrDefaultBSONSerializableOptions } from '../bson' ;
10
+ import { BSONSerializeOptions , Document , inheritOrDefaultBSONSerializableOptions } from '../bson' ;
11
11
import type { CollationOptions } from '../cmap/wire_protocol/write_command' ;
12
12
import type { ReadConcernLike } from './../read_concern' ;
13
13
@@ -45,6 +45,7 @@ export interface OperationParent {
45
45
promoteValues ?: boolean ;
46
46
promoteBuffers ?: boolean ;
47
47
ignoreUndefined ?: boolean ;
48
+ options ?: BSONSerializeOptions ;
48
49
} ;
49
50
readConcern ?: ReadConcern ;
50
51
writeConcern ?: WriteConcern ;
@@ -102,7 +103,8 @@ export abstract class CommandOperation<
102
103
// Assign all bsonOptions to OperationBase obj, preferring command options over parent options
103
104
// TODO, for collection it makes sense to take it from parent.s -- is this true for others?
104
105
// TODO: downside of this is after the command is created these values are *fixed* because they are already set to default/inherited values
105
- Object . assign ( this , inheritOrDefaultBSONSerializableOptions ( options , parent ?. s ) ) ;
106
+ const base = Object . assign ( { } , parent ?. s . options , parent ?. s ) ;
107
+ Object . assign ( this , inheritOrDefaultBSONSerializableOptions ( options , base ) ) ;
106
108
}
107
109
108
110
abstract execute ( server : Server , callback : Callback < TResult > ) : void ;
0 commit comments