If you structured your data as a map instead of an array (which it seems like you logically are using it as a map, with id
is your identifier) then you could use the Sub-document API’s DICT_UPSERT command.
See http://developer.couchbase.com/documentation/server/4.5/sdk/subdocument-operations.html, specifically upsert
.