UPDATE default
SET sb = { "_id": "3", "name": "Another Plane name", "enabled": false, ... } FOR sb IN subcategories WHEN sb._id = "3" END
WHERE _type = "Category"
Can you give me any example of it? I tried with this, but had no luck:
UPDATE default
SET sc.subsubcategories[i] = {"_id": "5","name": "Economy Car 2","enabled": false}
FOR i: ssc IN (ARRAY sc.subsubcategories FOR sc IN subcategories WHEN sc._id = "1" END) WHEN ssc._id = "5" END
WHERE _type = "Category";
UPDATE default
SET sc.subsubcategories[i] = { ... } FOR i: ssc IN sc.subsubcategories FOR sc IN subcategories WHEN ssc._id = "5" END
WHERE _type = "Category";
UPDATE default
SET sc.subsubcategories[i] = {"_id": “5”,“name”: “Economy Car 2”,“enabled”: false}
FOR i: ssc IN sc.subsubcategories FOR sc IN subcategories WHEN ssc._id = “5” END
WHERE _type = "Category"
RETURNING default.*;
You can use the following for now, which is equivalent. I am still troubleshooting the other syntax. Sorry about that.
UPDATE default d
SET sc.subsubcategories = ARRAY CASE WHEN ssc._id = "5" THEN {} ELSE ssc END FOR ssc IN sc.subsubcategories END FOR sc IN subcategories WHEN sc._id = "1" END
WHERE _type = "Category"
RETURNING d.*;