From fc5a512b5fd71e87f28ead834a863ae4ac988741 Mon Sep 17 00:00:00 2001 From: David Benedeki <14905969+benedeki@users.noreply.github.com> Date: Fri, 8 Dec 2023 16:57:02 +0100 Subject: [PATCH] #2199: Counting runs count takes too much MongoDB CPU (#2200) * replaced DB-intensive `documentCount` for `estimatedDocumentCount` --- .../co/absa/enceladus/menas/repositories/MongoRepository.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menas/src/main/scala/za/co/absa/enceladus/menas/repositories/MongoRepository.scala b/menas/src/main/scala/za/co/absa/enceladus/menas/repositories/MongoRepository.scala index 5d4aaeb7c..3aea034be 100644 --- a/menas/src/main/scala/za/co/absa/enceladus/menas/repositories/MongoRepository.scala +++ b/menas/src/main/scala/za/co/absa/enceladus/menas/repositories/MongoRepository.scala @@ -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 = {