Skip to content

Commit

Permalink
#2199: Counting runs count takes too much MongoDB CPU
Browse files Browse the repository at this point in the history
* replaced DB-intensive `documentCount` for `estimatedDocumentCount`
  • Loading branch information
benedeki committed Nov 13, 2023
1 parent 0849caa commit e98ee00
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 e98ee00

Please sign in to comment.