I have the following
Document.update(
("room" -> "test") ~ ("module" -> "item"),
("$set" ->
("active" -> 0)
)
)
However only one item is updated, how do I update all records that match?
Thanks in advance for any help, much appreciated 🙂
By default mongo only updates the first row it finds, to make it update multiple matching rows you need to pass the “multi” update option. In scala I believe it would look something like this:
Document.update(("room" -> "test") ~ ("module" -> "item"),
("$set" -> ("active" -> 0)),
Multi
)