Details
-
Improvement
-
Resolution: Won't Fix
-
Major - P3
-
None
-
3.5.6
-
None
-
Query
Description
The default parseNs(), defined in the base class Command, assumes the first element in the cmdObj holds the collection name. If that element is not a string, it assumes there's no collection. This works for commands of the form {find:"foo"}:
string Command::parseNs(const string& dbname, const BSONObj& cmdObj) const {
|
BSONElement first = cmdObj.firstElement();
|
if (first.type() != mongo::String)
|
return dbname;
|
|
|
return str::stream() << dbname << '.' << cmdObj.firstElement().valueStringData();
|
}
|
But explain commands, for example, which use the format {explain:{find:"foo"}}, should override parseNs().
Assigning to backlog-server-platform, but feel free to pass this to a better home if there is one.