Skip to content

Commit 8d4626c

Browse files
committed
Don't send writeConcern within transaction
1 parent 61b7d0f commit 8d4626c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pymongo/client_session.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ def _apply_to(self, command, is_retryable, read_preference):
378378
return
379379

380380
if self._in_transaction:
381+
# TODO: hack
382+
name = next(iter(command))
383+
if name not in ('commitTransaction', 'abortTransaction'):
384+
command.pop('writeConcern', None)
385+
381386
if read_preference != ReadPreference.PRIMARY:
382387
raise InvalidOperation(
383388
'read preference in a transaction must be primary, not: '

0 commit comments

Comments
 (0)