Lesson 4.3 on Covered Queries shows a projection whose projected fields are all “covered” in the index used for the query. The executionStats indicates PROJECTION_COVERED. This is straightforward.
I I remove “_id”: 0 from the projection (thus including _id) in the projection, the executionStats now indicates PROJECTION_SIMPLE, and contains a non-zero totalDocsExamined, indicating that the projection could not be satisfied by the index alone.
Here’s my question:
It seems to me that a very (the most?) common use case for a projection query would be to display the result set to the user in some sort of selector. One way I thought of to do this is to include _id as the last field in the index, e.g. {name: 1, cuisine: 1, stars: 1, _id: 1}.
Is this the suggested way of accomplishing this, or is there some better approach to getting a covered projection query that includes _id?