summaryrefslogtreecommitdiff
path: root/src/mongo/client/dbclient_cursor.cpp
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2020-10-19 20:09:34 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-23 05:08:16 +0000
commit1e84e697a9396c0923ffa1490dd8da356a6aacc0 (patch)
tree364fe968af0d4e0c1d301c17d50df5d940060d6f /src/mongo/client/dbclient_cursor.cpp
parent52d60041fcc406352a6dfcf981b9001f886b1230 (diff)
downloadmongo-1e84e697a9396c0923ffa1490dd8da356a6aacc0.tar.gz
SERVER-49791 Track operationTime in DBClient
Diffstat (limited to 'src/mongo/client/dbclient_cursor.cpp')
-rw-r--r--src/mongo/client/dbclient_cursor.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/client/dbclient_cursor.cpp b/src/mongo/client/dbclient_cursor.cpp
index 366cd760283..34fa4f0f272 100644
--- a/src/mongo/client/dbclient_cursor.cpp
+++ b/src/mongo/client/dbclient_cursor.cpp
@@ -341,8 +341,9 @@ void DBClientCursor::dataReceived(const Message& reply, bool& retry, string& hos
}
if (_useFindCommand) {
+ const auto replyObj = commandDataReceived(reply);
cursorId = 0; // Don't try to kill cursor if we get back an error.
- auto cr = uassertStatusOK(CursorResponse::parseFromBSON(commandDataReceived(reply)));
+ auto cr = uassertStatusOK(CursorResponse::parseFromBSON(replyObj));
cursorId = cr.getCursorId();
uassert(50935,
"Received a getMore response with a cursor id of 0 and the moreToCome flag set.",
@@ -352,6 +353,10 @@ void DBClientCursor::dataReceived(const Message& reply, bool& retry, string& hos
// Store the resume token, if we got one.
_postBatchResumeToken = cr.getPostBatchResumeToken();
batch.objs = cr.releaseBatch();
+
+ if (replyObj.hasField(LogicalTime::kOperationTimeFieldName)) {
+ _operationTime = LogicalTime::fromOperationTime(replyObj).asTimestamp();
+ }
return;
}