mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

Use estimated_documents_count OR documents_count based on query

Open bagerard opened this issue 4 years ago • 1 comments

Since .count was deprecated, MongoEngine was switched to the Collection.count_documents method exclusively. This caused major issue for people for simple cases where estimated_documents_count could be used.

This PR adds a bit of logic behind the .count() method to make use of estimated_count_documents whenever it is safe to do so.

bagerard avatar Jun 06 '21 13:06 bagerard

This is a fix for #2470

vainu-arto avatar Dec 09 '21 07:12 vainu-arto

@bagerard Is this safe to get merged? Seems like a sensible improvement

dhendo avatar Jul 16 '23 15:07 dhendo