Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-6995

Projection expressions appear to be ignored in explain in the latest version of Compass

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.39.0
    • Affects Version/s: 1.38.2
    • Component/s: Explain
    • None
    • Environment:
      OS: Windows 10 Pro
      node.js / npm versions:
      Additional info:
    • Not Needed
    • Iteration Edmontonia

      Problem Statement/Rationale

      Explain output shows no projection even when an expression is defined in the filter options.

      Steps to Reproduce

      Create a new collection and insert the following documents:
      [{   "_id": "P1",   "data": "P1data",   "relatedTo": "P1" }, {   "_id": "P2",   "data": "P2data",   "relatedTo": "P2" }, {   "_id": "C1",   "data": "C1data",   "relatedTo": [     "P1",     "P2"   ] }, {   "_id": "C2",   "data": "C2data",   "relatedTo": [     "P1",     "P2"   ] }]


      Create a compound index on {relatedTo:1, data:1}

      Set the following filter expression in Compass:


      Expand Options and set the following projection expression:
      {_id:0, data:1}

      Hit explain and examine the raw output.

      Expected Results

      I would expect the winning plan to be PROJECTION_COVERED and that the projection expression would be shown in the command section of the explain output. 

      Actual Results

      The index is used, but all documents are fetched since the projection expression is missing in the command section of the explain output.

            sergey.petushkov@mongodb.com Sergey Petushkov
            rick.houlihan@mongodb.com Rick Houlihan
            1 Vote for this issue
            2 Start watching this issue