WE add using ArrayAppendSpecs(). How do we delete it? As I understand Remove specs will remove the full document lists
All of items will be removed by removespec.
Do we have any API to remove an appended document at a sub-document level?
Also how to find an index of a sub-document array elements ? LookupIn?
I want to delete an element from subdocument array both by using KV and N1QL queries
Hi @rkunhi did you manage to find a way around this? I’m guessing that How to get the index of sub-document ?KV is also related to this. There is no way to either remove or get the index of an array element at the server (and therefore SDK) level for KV.
Your best bet is probably to do a lookupin of the array, remove the element, and then mutatein using the CAS value from the lookup to ensure that noone else modified the array in the meantime. Unforunately this is obviously two round trips rather than one.
There may be an alternative way to do this via N1QL, if so then maybe @vsr1 can assist here?
I have an array of sub-documents. Each sub-document array object has a key field. I want to lookup or remove a specific array object from the sub-document array how can I do it,. Please share an example