UPDATE magic-players
SET avatar.hero_upgrade = ARRAY v FOR v IN hero_upgrade WHEN v.id != 28000007 END
WHERE jsonType = "data" AND
ANY v IN avatar.hero_upgrade SATISFIES v.id = 28000007 END;
I am trying to remove the whole array which contains the id 28000007 while keeping every other array so it looks like:
You have right query only issue is you are using string vs number (remove quotes). In JSON type is attached to value.
(i.e. 1 is different from “1”, no implicit casting)
UPDATE `magic-players`
SET avatar.hero_upgrade = ARRAY v FOR v IN hero_upgrade WHEN v.id != 28000007 END
WHERE jsonType = "data" AND
ANY v IN avatar.hero_upgrade SATISFIES v.id = 28000007 END;
oh forgot to upload the edited code, my bad!
but it seems to be deleting the whole hero_upgrade array instead of only deleting the array inside which id 28000007 exists
UPDATE `magic-players`
UNSET hu.list FOR hu IN avatar.hero_upgrade WHEN v.id == 28000007 END
WHERE jsonType = "data" AND
ANY v IN avatar.hero_upgrade SATISFIES v.id = 28000007 AND v.list IS NOT MISSING END;