Skip to content

Commit 6a20101

Browse files
committed
first step to handle all parent impls
1 parent 9ce2c3f commit 6a20101

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/operations/command.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { commandSupportsReadConcern } from '../sessions';
77
import { MongoError } from '../error';
88
import type { Logger } from '../logger';
99
import type { Server } from '../sdam/server';
10-
import { Document, inheritOrDefaultBSONSerializableOptions } from '../bson';
10+
import { BSONSerializeOptions, Document, inheritOrDefaultBSONSerializableOptions } from '../bson';
1111
import type { CollationOptions } from '../cmap/wire_protocol/write_command';
1212
import type { ReadConcernLike } from './../read_concern';
1313

@@ -45,6 +45,7 @@ export interface OperationParent {
4545
promoteValues?: boolean;
4646
promoteBuffers?: boolean;
4747
ignoreUndefined?: boolean;
48+
options?: BSONSerializeOptions;
4849
};
4950
readConcern?: ReadConcern;
5051
writeConcern?: WriteConcern;
@@ -102,7 +103,8 @@ export abstract class CommandOperation<
102103
// Assign all bsonOptions to OperationBase obj, preferring command options over parent options
103104
// TODO, for collection it makes sense to take it from parent.s -- is this true for others?
104105
// 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));
106108
}
107109

108110
abstract execute(server: Server, callback: Callback<TResult>): void;

0 commit comments

Comments
 (0)