-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.5.6
-
Component/s: Internal Code
-
Labels:None
-
Query
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.