Reputation: 13
How to update all properties active to false if key of object is a number:
{
"id": 1,
"items": {
"2": {
"id": 2,
"active": true
},
"3": {
"id": 3,
"active": true
},
"5": {
"id": 5,
"active": true
}
},
"status": true
}
Upvotes: 1
Views: 400
Reputation: 7414
UPDATE default AS d
SET d.items.[v].active = false
FOR v IN OBJECT_NAMES(d.items) END
WHERE .....
Upvotes: 1