summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbmessage.h
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-06-21 16:09:31 -0400
committerMathias Stearn <mathias@10gen.com>2017-06-28 11:57:04 -0400
commit829e5b1628ce058509ada9e0ebaf00a712751193 (patch)
tree9b0916b29f43bdde27231e273a325959ff23e51a /src/mongo/db/dbmessage.h
parentb70aab6e1f4c3230da27aa04cb6fa25f2341b9a6 (diff)
downloadmongo-829e5b1628ce058509ada9e0ebaf00a712751193.tar.gz
SERVER-28509 Downconvert document sequences when serializing requests to old protocols
Diffstat (limited to 'src/mongo/db/dbmessage.h')
-rw-r--r--src/mongo/db/dbmessage.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/dbmessage.h b/src/mongo/db/dbmessage.h
index 959dc59edd0..2b7f4517c72 100644
--- a/src/mongo/db/dbmessage.h
+++ b/src/mongo/db/dbmessage.h
@@ -301,7 +301,7 @@ public:
* parses the message into the above fields
* Warning: constructor mutates DbMessage.
*/
- QueryMessage(DbMessage& d) {
+ explicit QueryMessage(DbMessage& d) {
ns = d.getns();
ntoskip = d.pullInt();
ntoreturn = d.pullInt();
@@ -311,6 +311,14 @@ public:
}
queryOptions = DataView(d.msg().header().data()).read<LittleEndian<int32_t>>();
}
+
+ /**
+ * A non-muting constructor from the whole message.
+ */
+ explicit QueryMessage(const Message& message) {
+ DbMessage dbm(message);
+ *this = QueryMessage(dbm);
+ }
};
/**