Dalam dokumentasi Anda dapat melihat contoh operasi massal untuk menyisipkan, memperbarui, atau menghapus.
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import reactivemongo.api.bson.BSONDocument
import reactivemongo.api.bson.collection.BSONCollection
def updateWithBulk(personColl: BSONCollection) = {
// Bulk update: multiple update
val updateBuilder1 = personColl.update(ordered = true)
val updates = Future.sequence(Seq(
updateBuilder1.element(
q = BSONDocument("firstName" -> "Jane", "lastName" -> "Doh"),
u = BSONDocument("age" -> 18),
upsert = true,
multi = false),
updateBuilder1.element(
q = BSONDocument("firstName" -> "Bob"),
u = BSONDocument("age" -> 19),
upsert = false,
multi = true)))
updates.flatMap { ops => updateBuilder1.many(ops) }
}