Skip to content

Commit

Permalink
#2199: Counting runs count takes too much MongoDB CPU (#2200)
Browse files Browse the repository at this point in the history
* replaced DB-intensive `documentCount` for `estimatedDocumentCount`
  • Loading branch information
benedeki authored Dec 8, 2023
1 parent 0849caa commit fc5a512
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ abstract class MongoRepository[C](mongoDb: MongoDatabase)(implicit ct: ClassTag[
}

def count(): Future[Long] = {
collection.countDocuments().toFuture()
collection.estimatedDocumentCount().toFuture()
}

private[repositories] def getNameFilter(name: String): Bson = {
Expand Down

0 comments on commit fc5a512

Please sign in to comment.