diff --git a/modules/ingestor/src/main/scala/ingestor.forum.scala b/modules/ingestor/src/main/scala/ingestor.forum.scala index 1468994e..9da9b6f0 100644 --- a/modules/ingestor/src/main/scala/ingestor.forum.scala +++ b/modules/ingestor/src/main/scala/ingestor.forum.scala @@ -3,7 +3,7 @@ package ingestor import cats.effect.IO import cats.syntax.all.* -import com.mongodb.client.model.changestream.OperationType +import com.mongodb.client.model.changestream.OperationType.* import lila.search.spec.ForumSource import mongo4cats.bson.Document import mongo4cats.database.MongoDatabase @@ -22,7 +22,8 @@ object ForumIngestor: private val topicProjection = Projection.include(List("_id", "name")) - private val eventFilter = Filter.in("operationType", List("replace", "insert")) + val interestedOperations = List(DELETE, INSERT, UPDATE, REPLACE).map(_.getValue) + private val eventFilter = Filter.in("operationType", interestedOperations) private val eventProjection = Projection.include( List( "documentKey._id", @@ -124,5 +125,5 @@ object ForumIngestor: private def topicId = event.fullDocument.flatMap(_.getString("topicId")) private def isDelete: Boolean = - event.operationType == OperationType.DELETE || + event.operationType == DELETE || event.fullDocument.flatMap(_.get("erasedAt")).isDefined