summaryrefslogtreecommitdiff
path: root/src/mongo/s/query
diff options
context:
space:
mode:
authorArun Banala <arun.banala@10gen.com>2019-09-24 16:50:09 +0000
committerevergreen <evergreen@mongodb.com>2019-09-24 16:50:09 +0000
commit60518c8920064b30df53129ea880dacfcb04be71 (patch)
treeaa9054360e25e2b3505dbced16bfb5922e606bb9 /src/mongo/s/query
parent7edbbc86d4ac06fddd3ab3482d2985392811032b (diff)
downloadmongo-60518c8920064b30df53129ea880dacfcb04be71.tar.gz
SERVER-29794 Adding a comment to all commands
Diffstat (limited to 'src/mongo/s/query')
-rw-r--r--src/mongo/s/query/cluster_find.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp
index e697d32f150..69fe465d4cb 100644
--- a/src/mongo/s/query/cluster_find.cpp
+++ b/src/mongo/s/query/cluster_find.cpp
@@ -371,6 +371,12 @@ Status setUpOperationContextStateForGetMore(OperationContext* opCtx,
ReadPreferenceSetting::get(opCtx) = *readPref;
}
+ // If the originating command had a 'comment' field, we extract it and set it on opCtx. Note
+ // that if the 'getMore' command itself has a 'comment' field, we give precedence to it.
+ auto comment = cursor->getOriginatingCommand()["comment"];
+ if (!opCtx->getComment() && comment) {
+ opCtx->setComment(comment.wrap());
+ }
if (cursor->isTailableAndAwaitData()) {
// For tailable + awaitData cursors, the request may have indicated a maximum amount of time
// to wait for new data. If not, default it to 1 second. We track the deadline instead via