diff options
author | Anthony Roy <anthony.roy@10gen.com> | 2018-06-19 17:53:48 -0400 |
---|---|---|
committer | Anthony Roy <anthony.roy@10gen.com> | 2018-07-05 17:43:25 -0400 |
commit | f78056a8f1f5ea6af23bd68123659b714233b370 (patch) | |
tree | ca9bf843fec69e4ba687bdee55dade490b5ac246 /src/mongo/rpc/op_msg.cpp | |
parent | 173ac70346990e4cf9b2720f86697785b8795967 (diff) | |
download | mongo-f78056a8f1f5ea6af23bd68123659b714233b370.tar.gz |
SERVER-35460 Replaced CommandReplyBuilder with direct usage of ReplyBuilderInterface
This is to provide access to DocumentSequence returns.
Diffstat (limited to 'src/mongo/rpc/op_msg.cpp')
-rw-r--r-- | src/mongo/rpc/op_msg.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/rpc/op_msg.cpp b/src/mongo/rpc/op_msg.cpp index f886027e192..9199693b0e0 100644 --- a/src/mongo/rpc/op_msg.cpp +++ b/src/mongo/rpc/op_msg.cpp @@ -247,4 +247,15 @@ Message OpMsgBuilder::finish() { return Message(_buf.release()); } +BSONObj OpMsgBuilder::releaseBody() { + invariant(_state == kBody); + invariant(_bodyStart); + invariant(_bodyStart == sizeof(MSGHEADER::Layout) + 4 /*flags*/ + 1 /*body kind byte*/); + invariant(!_openBuilder); + _state = kDone; + + auto bson = BSONObj(_buf.buf() + _bodyStart); + return bson.shareOwnershipWith(_buf.release()); +} + } // namespace mongo |