{"action":"created","comment":{"url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/comments/157534068","pull_request_review_id":84191688,"id":157534068,"diff_hunk":"@@ -182,8 +187,38 @@ def advance_cluster_time(new_cluster_time)\n       end\n     end\n \n+    # Advance the cached operation time for this session.\n+    #\n+    # @example Advance the operation time.\n+    #   session.advance_operation_time(timestamp)\n+    #\n+    # @param [ BSON::Timestamp ] new_operation_time The new operation time.\n+    #\n+    # @return [ BSON::Timestamp ] The max operation time, considering the current and new times.\n+    #\n+    # @since 2.5.0\n+    def advance_operation_time(new_operation_time)\n+      if @operation_time\n+        @operation_time = [ @operation_time, new_operation_time ].max\n+      else\n+        @operation_time = new_operation_time\n+      end\n+    end\n+\n     private\n \n+    def causal_consistency_doc(read_concern)\n+      if operation_time && causal_consistency?\n+        (read_concern || {}).merge(:afterClusterTime => operation_time)\n+      else\n+        read_concern\n+      end\n+    end\n+\n+    def causal_consistency?\n+      @causal_consistency ||= (!@options.key?(:causal_consistency) || @options[:causal_consistency])","path":"lib/mongo/session.rb","position":45,"original_position":45,"commit_id":"68c733d50bb0da4df8caa3df40727c4dd5a99189","original_commit_id":"68c733d50bb0da4df8caa3df40727c4dd5a99189","user":{"login":"saghm","id":5875560,"avatar_url":"https://avatars2.githubusercontent.com/u/5875560?v=4","gravatar_id":"","url":"https://api.github.com/users/saghm","html_url":"https://github.com/saghm","followers_url":"https://api.github.com/users/saghm/followers","following_url":"https://api.github.com/users/saghm/following{/other_user}","gists_url":"https://api.github.com/users/saghm/gists{/gist_id}","starred_url":"https://api.github.com/users/saghm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saghm/subscriptions","organizations_url":"https://api.github.com/users/saghm/orgs","repos_url":"https://api.github.com/users/saghm/repos","events_url":"https://api.github.com/users/saghm/events{/privacy}","received_events_url":"https://api.github.com/users/saghm/received_events","type":"User","site_admin":false},"body":"I'm not sure this line is doing what it's supposed to; if `:causal_consistency` isn't in `@options` (i.e. `@options.key?(:causal_consistency)` is false), this would set `@causal_consistency` to true. If I'm understanding the intended logic correctly, I think this should be `@options.key?(:causal_consistency) && @options[:causal_consistency]`.","created_at":"2017-12-18T16:32:38Z","updated_at":"2017-12-18T16:34:01Z","html_url":"https://github.com/mongodb/mongo-ruby-driver/pull/895#discussion_r157534068","pull_request_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/895","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/comments/157534068"},"html":{"href":"https://github.com/mongodb/mongo-ruby-driver/pull/895#discussion_r157534068"},"pull_request":{"href":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/895"}}},"pull_request":{"url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/895","id":157030110,"html_url":"https://github.com/mongodb/mongo-ruby-driver/pull/895","diff_url":"https://github.com/mongodb/mongo-ruby-driver/pull/895.diff","patch_url":"https://github.com/mongodb/mongo-ruby-driver/pull/895.patch","issue_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/issues/895","number":895,"state":"open","locked":false,"title":"RUBY-1230 Causally consistent reads","user":{"login":"estolfo","id":699369,"avatar_url":"https://avatars1.githubusercontent.com/u/699369?v=4","gravatar_id":"","url":"https://api.github.com/users/estolfo","html_url":"https://github.com/estolfo","followers_url":"https://api.github.com/users/estolfo/followers","following_url":"https://api.github.com/users/estolfo/following{/other_user}","gists_url":"https://api.github.com/users/estolfo/gists{/gist_id}","starred_url":"https://api.github.com/users/estolfo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estolfo/subscriptions","organizations_url":"https://api.github.com/users/estolfo/orgs","repos_url":"https://api.github.com/users/estolfo/repos","events_url":"https://api.github.com/users/estolfo/events{/privacy}","received_events_url":"https://api.github.com/users/estolfo/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-12-07T15:49:29Z","updated_at":"2017-12-18T16:34:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0112290e4b2888f1a832ee41ef51c56a1a32396e","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/895/commits","review_comments_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/895/comments","review_comment_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/issues/895/comments","statuses_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/statuses/68c733d50bb0da4df8caa3df40727c4dd5a99189","head":{"label":"estolfo:RUBY-1230-causally-consistent","ref":"RUBY-1230-causally-consistent","sha":"68c733d50bb0da4df8caa3df40727c4dd5a99189","user":{"login":"estolfo","id":699369,"avatar_url":"https://avatars1.githubusercontent.com/u/699369?v=4","gravatar_id":"","url":"https://api.github.com/users/estolfo","html_url":"https://github.com/estolfo","followers_url":"https://api.github.com/users/estolfo/followers","following_url":"https://api.github.com/users/estolfo/following{/other_user}","gists_url":"https://api.github.com/users/estolfo/gists{/gist_id}","starred_url":"https://api.github.com/users/estolfo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estolfo/subscriptions","organizations_url":"https://api.github.com/users/estolfo/orgs","repos_url":"https://api.github.com/users/estolfo/repos","events_url":"https://api.github.com/users/estolfo/events{/privacy}","received_events_url":"https://api.github.com/users/estolfo/received_events","type":"User","site_admin":false},"repo":{"id":8504548,"name":"mongo-ruby-driver","full_name":"estolfo/mongo-ruby-driver","owner":{"login":"estolfo","id":699369,"avatar_url":"https://avatars1.githubusercontent.com/u/699369?v=4","gravatar_id":"","url":"https://api.github.com/users/estolfo","html_url":"https://github.com/estolfo","followers_url":"https://api.github.com/users/estolfo/followers","following_url":"https://api.github.com/users/estolfo/following{/other_user}","gists_url":"https://api.github.com/users/estolfo/gists{/gist_id}","starred_url":"https://api.github.com/users/estolfo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estolfo/subscriptions","organizations_url":"https://api.github.com/users/estolfo/orgs","repos_url":"https://api.github.com/users/estolfo/repos","events_url":"https://api.github.com/users/estolfo/events{/privacy}","received_events_url":"https://api.github.com/users/estolfo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/estolfo/mongo-ruby-driver","description":"My fork of the Ruby driver to MongoDB","fork":true,"url":"https://api.github.com/repos/estolfo/mongo-ruby-driver","forks_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/forks","keys_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/teams","hooks_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/hooks","issue_events_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/issues/events{/number}","events_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/events","assignees_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/assignees{/user}","branches_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/branches{/branch}","tags_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/tags","blobs_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/languages","stargazers_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/stargazers","contributors_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/contributors","subscribers_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/subscribers","subscription_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/subscription","commits_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/contents/{+path}","compare_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/merges","archive_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/downloads","issues_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/issues{/number}","pulls_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/labels{/name}","releases_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/releases{/id}","deployments_url":"https://api.github.com/repos/estolfo/mongo-ruby-driver/deployments","created_at":"2013-03-01T15:47:27Z","updated_at":"2017-01-11T16:43:27Z","pushed_at":"2017-12-18T12:50:49Z","git_url":"git://github.com/estolfo/mongo-ruby-driver.git","ssh_url":"git@github.com:estolfo/mongo-ruby-driver.git","clone_url":"https://github.com/estolfo/mongo-ruby-driver.git","svn_url":"https://github.com/estolfo/mongo-ruby-driver","homepage":"http://api.mongodb.org/ruby","size":33147,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":4,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mongodb:master","ref":"master","sha":"20a85adf3176f205fb6180ac9428be25be8b2c69","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars1.githubusercontent.com/u/45120?v=4","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":108125,"name":"mongo-ruby-driver","full_name":"mongodb/mongo-ruby-driver","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars1.githubusercontent.com/u/45120?v=4","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mongodb/mongo-ruby-driver","description":"Ruby driver for MongoDB","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-ruby-driver","forks_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/releases{/id}","deployments_url":"https://api.github.com/repos/mongodb/mongo-ruby-driver/deployments","created_at":"2009-01-15T16:40:45Z","updated_at":"2017-12-16T19:35:21Z","pushed_at":"2017-12-18T12:50:51Z","git_url":"git://github.com/mongodb/mongo-ruby-driver.git","ssh_url":"git@github.com:mongodb/mongo-ruby-driver.git","clone_url":"https://github.com/mongodb/mongo-ruby-driver.git","svn_url":"https://github.com/mongodb/mongo-ruby-driver","homepage":"http://api.mongodb.org/ruby","size":33082,"stargazers_count":1323,"watchers_count":1323,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":473,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":473,"open_issues":6,"watchers":1323,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/895"},"html":{"href":"https://github.com/mongodb/mongo-ruby-driver/pull/895"},"issue":{"href":"https://api.github.com/repos/mongodb/mongo-ruby-driver/issues/895"},"comments":{"href":"https://api.github.com/repos/mongodb/mongo-ruby-driver/issues/895/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/895/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mongodb/mongo-ruby-driver/pulls/895/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/mongo-ruby-driver/statuses/68c733d50bb0da4df8caa3df40727c4dd5a99189"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"saghm"}}