Generic Sub-Document API in Couchbase

112 Views Asked by At

I want to update specific fields in below document stored in Couchbase :

 "name": "Douglas Reynholm",
  "email": "[email protected]",
  "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 ?

0

There are 0 best solutions below