Why can't we cover a query if any of the indexed fields are embedded documents?

Logically, we don’t need any information other than what is present in the index. So why does MongoDB have to worry about fetching documents catalogued by index. If fetching documents is not required, that means we have covered the query by fetching/scanning index data only.

Hi @Ashwin_Mahajan,
What version are you using?
From Query Optimization:

Changed in version 3.6 : An index can cover a query on fields within embedded documents

Thanks,
Rafael,

Hi Rafael

I actually brought this query based on instructor’s lecture on Covererd Query (M201-Chapter4 ,at 3:15)

Thanks,
Ashwin

Hi @Ashwin_Mahajan,
The video you’re talking about is from Feb 24, 2017.
Version 3.6 was released in November 2017.
Thanks,
Rafael,

1 Like