Assuming I have a couchbase document:
{
"a": 1,
"c": 2
}
What I want to do is to remove paths “a” and “b”. (I do not know if these fields are exists)
val mutateInSpecs = Seq(
MutateInSpec.remove("a"),
MutateInSpec.remove("b"),
)
collection.mutateIn(docId, mutateInSpecs)
Because of the atomicity feature of mutateIn operations. I get path not found exception for key “b” and key “a” is not removed.
Of course, I can do get query to see which fields are exists and update my mutateInSpecs.
However, Is there an option like removeIfPathExist which lets me remove fields that are only exist and ignore the ones that are not found?