[使用下面给出的数据模型:
{
"snapshots": [
{
"createdAt": "2019-03-15T06:31:04.447Z",
"entries": [
{
"balance": 139763,
"expiresOn": "3019-03-31T23:59Z"
},
{
"balance": 46961,
"expiresOn": "3019-03-31T23:59Z"
}
]
}
],
"type": "account"
}
我正在尝试更新快照数组的entries数组中的expiresOn字段,以下是我尝试但不起作用的查询。
UPDATE bucket
SET snapshot.entry.expiresOn = "2020-03-30T23:59Z"
FOR snapshot IN snapshots
FOR entry IN snapshot.entries
END
WHERE type = "account"
让它起作用,是一个愚蠢的错误。
json模型中的内部数组应该是查询中的外部for循环。
UPDATE bucket
SET snapshot.entry.expiresOn = "2020-03-30T23:59Z"
FOR entry IN snapshot.entries FOR snapshot IN snapshots END
WHERE type = "account"