@@ -130,12 +130,12 @@ def __init__(self, read_concern=None, write_concern=None):
130
130
raise ConfigurationError (
131
131
"transactions must use an acknowledged write concern, "
132
132
"not: %r" % (write_concern ,))
133
-
133
+
134
134
@property
135
135
def read_concern (self ):
136
136
"""This transaction's :class:`~read_concern.ReadConcern`."""
137
137
return self ._read_concern
138
-
138
+
139
139
@property
140
140
def write_concern (self ):
141
141
"""This transaction's :class:`~write_concern.WriteConcern`."""
@@ -387,11 +387,18 @@ def _apply_to(self, command, is_retryable, read_preference):
387
387
# First statement begins a new transaction.
388
388
self ._server_session ._transaction_id += 1
389
389
command ['startTransaction' ] = True
390
- read_concern = command .setdefault ('readConcern' , {})
391
- read_concern ['level' ] = 'snapshot'
390
+
391
+ if self ._transaction .opts .read_concern :
392
+ rc = self ._transaction .opts .read_concern .document
393
+ else :
394
+ rc = {}
395
+
392
396
if (self .options .causal_consistency
393
397
and self .operation_time is not None ):
394
- read_concern ['afterClusterTime' ] = self .operation_time
398
+ rc ['afterClusterTime' ] = self .operation_time
399
+
400
+ if rc :
401
+ command ['readConcern' ] = rc
395
402
396
403
command ['txnNumber' ] = self ._server_session .transaction_id
397
404
command ['stmtId' ] = self ._server_session .statement_id
0 commit comments