Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-28847

ensure all subclasses of Command override parseNs() if they have a non-default command format

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 3.5.6
    • Internal Code
    • 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.

      Attachments

        Activity

          People

            backlog-server-query Backlog - Query Team (Inactive)
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: