Hello, enjoying the M121 course material so far.
The principal reason I am taking the course is to learn more about how indexes are utilized in the aggregate pipeline generally and in $graphLookup and $lookup specifically.
Starting with $graphLookup. The materials indicate that the field referenced in the
connectToField should be indexed. That makes sense. I have the following questions:
- Is it possible to have covered queries of the proper compound indexes exist along with a $project stage subsequent to the $graphLookup stage?
- Will indexes be used if
restrictSearchWithMatchis specified and the fields in that query are also properly indexed?
- How does one go about determining what indexes are being utilized by a $graphLookup operation? My experience has been that .explain(‘executionStats’) does not produce useful information beyond indexes that might be used by the initial $match stage.