gpt4 book ai didi

arangodb - 过滤 ArangoDB 中的数组值

转载 作者:行者123 更新时间:2023-12-04 11:24:12 25 4
gpt4 key购买 nike

我有一个这样的文件:

{   "baths": 2,   "beds": 3,   "id": "3225C",   "addrs": [
{
"line2": "",
"line3": "",
"state": "OH",
"zip": "67845",
"line1": "3225 ABC AVE",
"city": "CLEVELAND"
},
{
"line2": "",
"line3": "",
"state": "FL",
"zip": "32818",
"line1": "2438 DEF AVE",
"city": "ORLANDO"
} ], "homeAddress": {
"line2": "",
"line3": "",
"state": "FL",
"zip": "32818",
"line1": "1234 CHICOTA AVE",
"city": "ORLANDO" }, "rentingAddresses": {
"ownsObjects": true,
"count": 0,
"arrayManager": {},
"items": [] }, "mailAddress": [
"4561 RAYCO AVE",
"",
"",
"ORLANDO",
"FL",
"32818" ] }

我正在尝试查找哪些客户端具有状态为“OH”的 addrs。我的 aql 查询是:
for client in clients.addrs
filter client.state == "OH"
return client

但我不断收到 [1563] list expected 。还有其他方法可以处理数组吗?

最佳答案

你可以这样做:

FOR client IN clients
FILTER 'OH' IN client.addrs[*].state
RETURN client

这应该返回所有包含至少一个元素的客户端
带有“状态”==“OH”的“addrs”属性

关于arangodb - 过滤 ArangoDB 中的数组值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24351440/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com