I want to update specific fields in below document stored in Couchbase :
"name": "Douglas Reynholm",
"email": "douglas@reynholmindustries.com",
"addresses": {
"billing": {
"line1": "123 Any Street",
"line2": "Anytown ",
"country": "United Kingdom"
},
"delivery": {
"line1": "123 Any Street",
"line2": "Anytown ",
"country": "United Kingdom"
}
},
"purchases": {
"complete": [
339, 976, 442, 666
],
"abandoned": [
157, 42, 999
]
}
}
How can I write a generic query using Java SDK to handle all possible combinations of subdocument update ? For example one user wants to update "addresses.delivery.country" field and other user wants to update "name" field.
It would be tough to right customized query for each possible case of subdocument update.. is that correct ?
"addresses": { "billing": { "country": "United Kingdom" }, }
Next time User will send below payload in PUT api to update just email:
"email": "newemail@gmail.com",
I should be able to handle all such cases with generic query. Thats the aim. – Mayank Feb 15 '20 at 09:27