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:
{relatedTo:"P1"}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.