I have a bucket with around 46k docs. Requirement is to delete a specific element from an array from the documents. I will not be having the list of document keys as the number of documents to update might vary from 10-46ooo
Currently doing it using N1QL query.
Removing 123456 from the array and keeping all the other elements as it is.
UPDATE Test AS d
SET d.children= ARRAY l FOR l IN d.children WHEN l.childId != “123456” END
WHERE ANY v IN d.children SATISFIES v.childId = “123456” END;
CREATE INDEX ix1 ON Test (DISTINCT ARRAY v.childId FOR v IN children END);
Is there a better way of achieving this?