Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-547

Causal Consistency Examples for the Manual

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: Docs Examples
    • Labels:
      None
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      PHPLIB-382 Fixed
      SWIFT-190 Fixed 0.2.0
      NODE-1615 Backlog
      PYTHON-1623 Fixed 3.8
      CSHARP-2351 Fixed
      PERL-986 Fixed 2.1.0
      RUBY-1429 Backlog
      JAVA-2921 Fixed
      CXX-1630 Fixed 3.7.0, 3.7.0-beta1
      MOTOR-265 Fixed 2.1
      GODRIVER-517 Done
      CDRIVER-2790 Fixed 1.14.0
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion PHPLIB-382 Fixed SWIFT-190 Fixed 0.2.0 NODE-1615 Backlog PYTHON-1623 Fixed 3.8 CSHARP-2351 Fixed PERL-986 Fixed 2.1.0 RUBY-1429 Backlog JAVA-2921 Fixed CXX-1630 Fixed 3.7.0, 3.7.0-beta1 MOTOR-265 Fixed 2.1 GODRIVER-517 Done CDRIVER-2790 Fixed 1.14.0

      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
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: