-
Type: Improvement
-
Resolution: Works as Designed
-
Priority: Critical - P2
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
I noticed `Model.count` was slow, after looking into the logs I noticed its doing `db.model.aggregate([{'$match': {} }, { '$group': { _id: 1, count:
{ '$sum': 1 }} }])`. This seems very very odd and explains why this is slow. I would expect it to use `db.model.find({}).count()` (if i do `Model.collection.count` it is fast, as i would expect cause its using the db.model.find({}).count()`)
- is caused by
-
MONGOID-4898 Add an estimated_count method to model classes, change count to use count_documents
- Closed