summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-09-05 13:31:55 -0400
committerMathias Stearn <mathias@10gen.com>2017-09-11 11:01:31 -0400
commit83242faed10c8ce6bd78e20dcfd791408d84e51a (patch)
tree7de2a08a5e0b0defbd5cb966fa791c032699884a /src/mongo
parentbacb63bbf80d6c9ddfa9d021fdae0748f7894a49 (diff)
downloadmongo-83242faed10c8ce6bd78e20dcfd791408d84e51a.tar.gz
SERVER-30700 Better error message on $db in OP_QUERY request
Previously this would fail with a confusing error about a duplicate top-level $db field.
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/rpc/metadata.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mongo/rpc/metadata.cpp b/src/mongo/rpc/metadata.cpp
index 1c95653137d..2d569de56bd 100644
--- a/src/mongo/rpc/metadata.cpp
+++ b/src/mongo/rpc/metadata.cpp
@@ -176,6 +176,8 @@ OpMsgRequest upconvertRequest(StringData db, BSONObj cmdObj, int queryFlags) {
cmdObj = bodyBuilder.obj();
}
+ uassert(40621, "$db is not allowed in OP_QUERY requests", !cmdObj.hasField("$db"));
+
// Try to move supported array fields into document sequences.
auto docSequenceIt = docSequenceFieldsForCommands.find(cmdObj.firstElementFieldName());
auto docSequenceElem = docSequenceIt == docSequenceFieldsForCommands.end()