Details
-
Task
-
Status: Implementing
-
Major - P3
-
Resolution: Unresolved
-
None
-
None
Description
Hi –
could we get the following causal consistency examples for the various drivers?
I mocked up the template in python
|
# Start Causal Consistency Example 1 |
|
with client.start_session(causal_consistency=True) as s1: |
current_date = datetime.datetime.today() |
items = client.get_database('test', |
read_concern=ReadConcern("majority"), |
write_concern=WriteConcern(w='majority', wtimeout=1000)).items |
items.update_one({'sku': "111", 'end': None }, {'$set': {'end': current_date}}, session=s1) |
items.insert_one({'sku': "nuts-111", 'name': "Pecans", 'start': current_date}, session=s1) |
|
# End Causal Consistency Example 1 |
|
# Start Causal Consistency Example 2 |
|
with client.start_session(causal_consistency=True) as s2: |
s2.advance_cluster_time(s1.cluster_time)
|
s2.advance_operation_time(s1.operation_time)
|
|
items = client.get_database('test', read_preference=ReadPreference.SECONDARY, |
read_concern=ReadConcern("majority"), |
write_concern=WriteConcern(w='majority', wtimeout=1000)).items |
for item in items.find({'end': None}, session=s2): |
print(item) |
|
# End Causal Consistency Example 2 |
Attachments
Issue Links
- depends on
-
NODE-1615 Causal Consistency Examples for the Manual
-
- Backlog
-
-
CDRIVER-2790 Causal Consistency Examples for the Manual
-
- Closed
-
-
CSHARP-2351 Causal Consistency Examples for the Manual
-
- Closed
-
-
CXX-1630 Causal Consistency Examples for the Manual
-
- Closed
-
-
GODRIVER-517 Causal Consistency Examples for the Manual
-
- Closed
-
-
JAVA-2921 Causal Consistency Examples for the Manual
-
- Closed
-
-
MOTOR-265 Causal Consistency Examples for the Manual
-
- Closed
-
-
PYTHON-1623 Causal Consistency Examples for the Manual
-
- Closed
-
-
RUBY-1429 Causal Consistency Examples for the Manual
-
- Backlog
-
-
PHPLIB-382 Causal Consistency Examples for the Manual
-
- Closed
-
- related to
-
DOCS-11882 New examples for causally consistent sessions
-
- Closed
-