Skip to content

Commit 4b4ccdf

Browse files
throw error on runCommand too
1 parent 8389a35 commit 4b4ccdf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/operations/execute_operation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export async function executeOperation<
122122
if (
123123
inTransaction &&
124124
!readPreference.equals(ReadPreference.primary) &&
125-
operation.hasAspect(Aspect.READ_OPERATION)
125+
(operation.hasAspect(Aspect.READ_OPERATION) || operation.commandName === 'runCommand')
126126
) {
127127
throw new MongoTransactionError(
128128
`Read preference in a transaction must be primary, not: ${readPreference.mode}`

0 commit comments

Comments
 (0)