Delete nested field

Hi
I`m trying to delete nested field from documents using path

DELETE  b.`Set`[*].`field`
FROM `TEMP` b
WHERE s_info.`type` = "type_name"
    AND s_info.category IS MISSING
    AND s_info.`system` = "test_system"
    AND b.`Set`[*].`field` IS NOT MISSING

DELETE statement is delete of whole document.
You should use UNSET of UPDATE FOR ARRAY UPDATE | Couchbase Docs

UPDATE FROM `TEMP` b
UNSET v.field  FOR v IN b.`Set` END
WHERE s_info.`type` = "type_name"
    AND s_info.category IS MISSING
    AND s_info.`system` = "test_system"
    AND ARRAY_LENGTH(b.`Set`[*].`field`) > 0 ;
1 Like