Antoine Girbal about counts in MongoDB:
Doing counts in MongoDB has always been a slow operation even on an indexed
field… until now. To do the count, it would iterate through every single
element in the index and try to match the key, giving a response time of
several seconds for just a million documents. It would be especially slow on
values with high cardinality, meaning that the count is high.
A bug-fix and an optimization using MongoDB’s B-trees.
Original title and link: Counting in MongoDB Just Got Much Faster ( ©myNoSQL)