|
Hi danielp@bompracredito.com.br,
Thanks for the report, looking over the aggregation pipeline. I suspect that the issue you are observing is the result of missing a $ preceeding otherproperty
$and:[{"$eq": ["$matchKey","$$id"]},{"$eq":["otherproperty",1]}]
|
As it stands, the string "otherproperty" will never be equal to 1. If you rewrite this line as
$and:[{"$eq": ["$matchKey","$$id"]},{"$eq":["$otherproperty",1]}]
|
I would expect the appropriate index to be used.
To help identify these issues faster, I've opened SERVER-33642 as an improvement to alert the user when there is malformed query of this nature rather than proceeding with a COLLSCAN which will return no results. Please feel free to vote for it and watch it for updates.
Kind regards,
Kelsey
|