File tree 4 files changed +10
-10
lines changed
4 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ export interface CommandOptions extends BSONSerializeOptions {
110
110
omitReadPreference ?: boolean ;
111
111
112
112
// FIXME: NODE-2802
113
- willRetryWrite ?: boolean ;
113
+ willRetryWrites ?: boolean ;
114
114
115
115
// FIXME: NODE-2781
116
116
writeConcern ?: WriteConcernOptions | WriteConcern | W ;
Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ function executeWithServerSelection(
259
259
supportsRetryableReads ( server ) &&
260
260
operation . canRetryRead ;
261
261
262
- const willRetryWrite =
262
+ const willRetryWrites =
263
263
topology . s . options . retryWrites === true &&
264
264
! inTransaction &&
265
265
supportsRetryableWrites ( server ) &&
@@ -268,9 +268,9 @@ function executeWithServerSelection(
268
268
const hasReadAspect = operation . hasAspect ( Aspect . READ_OPERATION ) ;
269
269
const hasWriteAspect = operation . hasAspect ( Aspect . WRITE_OPERATION ) ;
270
270
271
- if ( ( hasReadAspect && willRetryRead ) || ( hasWriteAspect && willRetryWrite ) ) {
272
- if ( hasWriteAspect && willRetryWrite ) {
273
- operation . options . willRetryWrite = true ;
271
+ if ( ( hasReadAspect && willRetryRead ) || ( hasWriteAspect && willRetryWrites ) ) {
272
+ if ( hasWriteAspect && willRetryWrites ) {
273
+ operation . options . willRetryWrites = true ;
274
274
session . incrementTransactionNumber ( ) ;
275
275
}
276
276
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export abstract class AbstractOperation<TResult = any> {
57
57
bsonOptions ?: BSONSerializeOptions ;
58
58
59
59
// TODO: Each operation defines its own options, there should be better typing here
60
- options : Document ;
60
+ options : OperationOptions ;
61
61
62
62
[ kSession ] : ClientSession ;
63
63
Original file line number Diff line number Diff line change @@ -937,7 +937,7 @@ export class ServerSessionPool {
937
937
export function applySession (
938
938
session : ClientSession ,
939
939
command : Document ,
940
- options ? : CommandOptions
940
+ options : CommandOptions
941
941
) : MongoDriverError | undefined {
942
942
// TODO: merge this with `assertAlive`, did not want to throw a try/catch here
943
943
if ( session . hasEnded ) {
@@ -963,10 +963,10 @@ export function applySession(
963
963
command . lsid = serverSession . id ;
964
964
965
965
// first apply non-transaction-specific sessions data
966
- const inTransaction = session . inTransaction ( ) || isTransactionCommand ( command ) ;
967
- const isRetryableWrite = options ?. willRetryWrite || false ;
966
+ const inTransaction = session . inTransaction ( ) ?? isTransactionCommand ( command ) ;
967
+ const isRetryableWrite = options . willRetryWrites ?? false ;
968
968
969
- if ( serverSession . txnNumber && ( isRetryableWrite || inTransaction ) ) {
969
+ if ( isRetryableWrite || inTransaction ) {
970
970
command . txnNumber = Long . fromNumber ( serverSession . txnNumber ) ;
971
971
}
972
972
You can’t perform that action at this time.
0 commit comments