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

Dead code in IDHackRunner::applyProjection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.6.2
    • Fix Version/s: 2.7.3
    • Component/s: Querying
    • Labels:
    • Operating System:
      ALL

      Description

      IDHackRunner::applyProjection checks if _query->getProj()->wantIndexKey() is true in two separate conditions (on line 188 and line 195). The condition on line 195 can never be true, though, because the first if block would have already executed.

      idhack_runner.cpp::

      188        if (_query->getProj()->wantIndexKey()) {
      189            // $returnKey is specified. This overrides everything else.
      190            BSONObjBuilder bob;
      191            const BSONObj& queryObj = _query->getParsed().getFilter();
      192            bob.append(queryObj["_id"]);
      193            return bob.obj();
      194        }
      195        else if (_query->getProj()->requiresDocument() || _query->getProj()->wantIndexKey()) {
                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      196            // Not a simple projection, so fallback on the regular projection path.
      197            BSONObj projectedObj;
      198            ProjectionExec projExec(projObj, _query->root());
      199            projExec.transform(docObj, &projectedObj);
      200            return projectedObj;
      201        }


      Version: 3d19c459fe80fb7aa3244174b61994f13f71c21f

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: