Hi
I want update nested object
Example:
{
“id”: “1”,
“childs”: [
{
“id”: “21”,
“childs”: [
{
“id”: “31”
}
]
}
…
]
}
UPDATE defaul d
SET p = {“id”:“111”}
FOR p WITHIN d.childs WHEN p.id = “31” END;
Actually the object contains not only “id” and “childs”. I would like to update it whole
Is there such an opportunity?
Thanks
p is variable you can’t replace variable value. You can only update the field inside.
In your case you want recursively update that is not possible. If you want u can do
UPDATE defaul d
SET p.id = "111"
FOR p WITHIN d.childs WHEN p.id = "31" END;