Hello,
In the WhatsCooking project, there are a default index to performe $search stage and another index (facetIndex) to performe $searchMeta stage. Is this a good practice and why? Can I have a single index for perform $search and $searchMeta stages?
Hi @Matheus_Souza and welcome to the MongoDB community forum!!
The $searchMeta stage of the aggregation pipeline, having the same syntax as $search, returns the Metadata information related to the search query.
To answer your question:
The same index can be used for both the operators, keeping in mind the output for both the stages would be different.
Let us know if you have any further questions.
Best Regards Aasawari