Please let me know if its possible to delete an element from the children array based on the Id from the below sample document .
i.e. I need to delete all the details of Id=100( delete the entire element in the array)
UPDATE default AS d
UNSET d.age
FOR dt IN c.Details FOR c IN d.children WHEN c.Id = "100" AND dt.fname = "Alex" END
WHERE d.type = "contact" AND d.email = "ian@gmail.com";
“Tutorial” is the bucket name .
I am getting this error "“Keyspace not found in CB datastore keyspace default - cause: No bucket named default”. Could you please help?
Removes age field in Details that matches fname “Alex”, underneath children id is “100” of document type “contact” and email “ian@gmail.com”
UPDATE tutorial AS d
UNSET dt.age
FOR dt IN c.Details FOR c IN d.children WHEN c.Id = "100" AND dt.fname = "Alex" END
WHERE d.type = "contact" AND d.email = "ian@gmail.com";
Removes Details underneath children id is “100” of document type “contact” and email “ian@gmail.com”
UPDATE tutorial AS d
UNSET c.Details
FOR c IN d.children WHEN c.Id = "100" END
WHERE d.type = "contact" AND d.email = "ian@gmail.com";
Removes Details underneath children id is “100” of document type “contact” and email “ian@gmail.com” of document id “ian”
UPDATE tutorial AS d USE KEYS "ian"
UNSET c.Details
FOR c IN d.children WHEN c.Id = "100" END
WHERE d.type = "contact" AND d.email = "ian@gmail.com";
Removes children id is “100” of document type “contact” and email “ian@gmail.com” of document id “ian”
UPDATE tutorial AS d USE KEYS "ian"
SET d.children = ARRAY c FOR c IN d.children WHEN c.Id != "100" END
WHERE d.type = "contact" AND d.email = "ian@gmail.com";