Uploaded image for project: 'PHP ORMs'
  1. PHP ORMs
  2. PHPORM-91

Implement Model::estimatedCount() for performance needs

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 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.

       

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: