-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Laravel, Performance
-
None
Follow https://github.com/mongodb/laravel-mongodb/issues/2626
In PHPORM-50, the implementation of Builder::count() was modified to not use the deprecated Collection::count(), but the new Collection::countDocuments(). This have a negative impact on performance when people needs to count all documents of a collection.
Proposition: Add a new method Builder::estimatedCount() that it can also be used from the model: Model::estimatedCount().
We need to throw an exception if this method is used while the query builder have $wheres predicated, because that's not supported by MongoDB Server.
- related to
-
PHPORM-50 Remove usage of the deprecated MongoDB\Collection::count
- Closed