I have a huge JSON object (document) stored in couchbase .
‘c’: [[23,34], [23, 67]],
I just want to update value for ‘c’ to something like: ‘c’: [[23,34], [23, 67], [89,56]].
How can I do this?
Do I need to load entire document to do such an operation?
If use N1QL UPDATE statement it will fetch whole document and update whole document. SDK’s provide subdoc API (https://docs.couchbase.com/server/5.1/developer-guide/sub-doc-api.html ) to update specific path and you can explore Mutating Array Fields.
N1QL Update statement looks as follows.
UPDATE default AS d
SET d.c = ARRAY_APPEND(d.c, [89,56])
Thanks you very much
I will try this and will come back.