Replace text of an element in an array

UPDATE default d
SET d.a = "xyz"
WHERE d.b = 5;

If above statement run multiple times mutation is repeated.

Below statement second time will not mutate. This may not always possible ( when more than one set/unset)

UPDATE default d
SET d.a = "xyz"
WHERE d.b = 5 AND d.a != "xyz";

If you have large number of documents easiest option will be eventing Examples: Using the Eventing Service | Couchbase Docs

Check post 24 from @jon.strabala N1QL CBQ Update million records is not working - #24 by jon.strabala