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