summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context.h
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/db/operation_context.h
parent7edbbc86d4ac06fddd3ab3482d2985392811032b (diff)
downloadmongo-60518c8920064b30df53129ea880dacfcb04be71.tar.gz
SERVER-29794 Adding a comment to all commands
Diffstat (limited to 'src/mongo/db/operation_context.h')
-rw-r--r--src/mongo/db/operation_context.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h
index a834f89ae1d..43553efae9b 100644
--- a/src/mongo/db/operation_context.h
+++ b/src/mongo/db/operation_context.h
@@ -373,6 +373,15 @@ public:
_inMultiDocumentTransaction = true;
}
+ void setComment(const BSONObj& comment) {
+ _comment = comment.getOwned();
+ }
+
+ boost::optional<BSONElement> getComment() {
+ // The '_comment' object, if present, will only ever have one field.
+ return _comment ? boost::optional<BSONElement>(_comment->firstElement()) : boost::none;
+ }
+
private:
IgnoreInterruptsState pushIgnoreInterrupts() override {
IgnoreInterruptsState iis{_ignoreInterrupts,
@@ -498,6 +507,10 @@ private:
bool _writesAreReplicated = true;
bool _shouldParticipateInFlowControl = true;
bool _inMultiDocumentTransaction = false;
+
+ // If populated, this is an owned singleton BSONObj whose only field, 'comment', is a copy of
+ // the 'comment' field from the input command object.
+ boost::optional<BSONObj> _comment;
};
namespace repl {