Skip to content

Commit 00b6726

Browse files
FIX: explicitly state read and write concern in causal consistency examples (mongodb#374)
PYTHON-1623 Causal Consistency Examples for the Manual
1 parent 6afcf14 commit 00b6726

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/test_examples.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,9 @@ def test_causal_consistency(self):
11281128
# Start Causal Consistency Example 1
11291129
with client.start_session(causal_consistency=True) as s1:
11301130
current_date = datetime.datetime.today()
1131-
items = client.get_database('test').items
1131+
items = client.get_database(
1132+
'test', read_concern=ReadConcern('majority'),
1133+
write_concern=WriteConcern('majority', wtimeout=1000)).items
11321134
items.update_one(
11331135
{'sku': "111", 'end': None},
11341136
{'$set': {'end': current_date}}, session=s1)
@@ -1143,7 +1145,9 @@ def test_causal_consistency(self):
11431145
s2.advance_operation_time(s1.operation_time)
11441146

11451147
items = client.get_database(
1146-
'test', read_preference=ReadPreference.SECONDARY).items
1148+
'test', read_preference=ReadPreference.SECONDARY,
1149+
read_concern=ReadConcern('majority'),
1150+
write_concern=WriteConcern('majority', wtimeout=1000)).items
11471151
for item in items.find({'end': None}, session=s2):
11481152
print(item)
11491153
# End Causal Consistency Example 2

0 commit comments

Comments
 (0)