Weird behaviour with query builder and indexes

Markus Halttunen shared this question 6 years ago

I had this kind of a query (overly simplified):


I had an index for "details.className" but the query was not hitting it. It was performing a collection scan. When I changed the query like this:


It started to work. However, even the first query was producing correct results - it was just very slow. What could explain this?

Replies (1)


Thank you for you feedback. It 's a serious bug.

We have worked out a hotfix 4.6.1 to resolve the issue. Please download and give it a try.

db.eventLog.aggregate().match(qb.where("details.className").eq("MyEvent")).count()// it should works.

Leave a Comment
Attach a file