diff options
author | Arun Banala <arun.banala@10gen.com> | 2019-09-24 16:50:09 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-24 16:50:09 +0000 |
commit | 60518c8920064b30df53129ea880dacfcb04be71 (patch) | |
tree | aa9054360e25e2b3505dbced16bfb5922e606bb9 /src/mongo/db/operation_context.h | |
parent | 7edbbc86d4ac06fddd3ab3482d2985392811032b (diff) | |
download | mongo-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.h | 13 |
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 { |