@@ -14,7 +14,7 @@ import { ReadConcern } from './read_concern';
14
14
import type { Connection } from './cmap/connection' ;
15
15
import { readFileSync } from 'fs' ;
16
16
import { resolve } from 'path' ;
17
- import { Document , resolveBSONOptions } from './bson' ;
17
+ import { BSONSerializeOptions , Document , resolveBSONOptions } from './bson' ;
18
18
import type { IndexSpecification , IndexDirection } from './operations/indexes' ;
19
19
import type { MongoClient } from './mongo_client' ;
20
20
import type { Cursor } from './cursor/cursor' ;
@@ -1091,10 +1091,10 @@ export function resolveOptions<T extends CommandOperationOptions>(
1091
1091
parent : OperationParent | undefined ,
1092
1092
options ?: T
1093
1093
) : T {
1094
- const result : T = Object . assign ( { } , options ) ;
1095
- const session = options ?. session ;
1094
+ const result : T = Object . assign ( { } , options , resolveBSONOptions ( options , parent ) ) ;
1096
1095
1097
1096
// Users cannot pass a readConcern/writeConcern to operations in a transaction
1097
+ const session = options ?. session ;
1098
1098
if ( ! session ?. inTransaction ( ) ) {
1099
1099
const readConcern = ReadConcern . fromOptions ( options ) ?? parent ?. readConcern ;
1100
1100
if ( readConcern ) {
@@ -1112,7 +1112,5 @@ export function resolveOptions<T extends CommandOperationOptions>(
1112
1112
result . readPreference = readPreference ;
1113
1113
}
1114
1114
1115
- const bsonOptions = resolveBSONOptions ( result , parent ) ;
1116
-
1117
- return { ...result , ...bsonOptions } ;
1115
+ return result ;
1118
1116
}
0 commit comments