Skip to content

Commit ff5b12e

Browse files
committed
fix: "willRetryWrites"
1 parent ffba0f4 commit ff5b12e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/operations/execute_operation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ function executeWithServerSelection<TResult>(
249249

250250
if ((hasReadAspect && willRetryRead) || (hasWriteAspect && willRetryWrite)) {
251251
if (hasWriteAspect && willRetryWrite) {
252-
operation.options.willRetryWrite = true;
252+
operation.options.willRetryWrites = true;
253253
session.incrementTransactionNumber();
254254
}
255255

src/operations/operation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export abstract class AbstractOperation<TResult = any> {
5757
bsonOptions?: BSONSerializeOptions;
5858

5959
// TODO: Each operation defines its own options, there should be better typing here
60-
options: Document;
60+
options: OperationOptions;
6161

6262
[kSession]: ClientSession | undefined;
6363

src/sessions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -964,10 +964,10 @@ export function applySession(
964964
command.lsid = serverSession.id;
965965

966966
// first apply non-transaction-specific sessions data
967-
const inTransaction = session.inTransaction() || isTransactionCommand(command);
968-
const isRetryableWrite = options?.willRetryWrite || false;
967+
const inTransaction = session.inTransaction() ?? isTransactionCommand(command);
968+
const isRetryableWrite = options.willRetryWrites ?? false;
969969

970-
if (serverSession.txnNumber && (isRetryableWrite || inTransaction)) {
970+
if (isRetryableWrite || inTransaction) {
971971
command.txnNumber = Long.fromNumber(serverSession.txnNumber);
972972
}
973973

0 commit comments

Comments
 (0)