Skip to content

Commit 360975a

Browse files
mbroadstdaprahamian
authored andcommitted
fix: only check for transaction state if session exists
1 parent 875e04e commit 360975a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/operations/execute_operation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function executeWithServerSelection(topology, operation, callback) {
126126

127127
const shouldRetryReads =
128128
topology.s.options.retryReads !== false &&
129-
!operation.session.inTransaction() &&
129+
(operation.session && !operation.session.inTransaction()) &&
130130
maxWireVersion(server) >= 6;
131131

132132
if (operation.hasAspect(Aspect.RETRYABLE) && shouldRetryReads) {

0 commit comments

Comments
 (0)