过滤ArangoDB中的数组值

Ler*_*ato 7 arangodb

我有一个这样的文件:

{   "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"   ] }
Run Code Online (Sandbox Code Playgroud)

我正试图找出哪个客户addrs所处的州位于"OH".我的aql查询是:

for client in clients.addrs
filter client.state == "OH"
return client
Run Code Online (Sandbox Code Playgroud)

但我一直在努力[1563] list expected.还有其他方法可以使用数组吗?

fce*_*ler 9

你可以这样做:

FOR client IN clients
   FILTER 'OH' IN client.addrs[*].state
   RETURN client
Run Code Online (Sandbox Code Playgroud)

这应该返回"addrs"属性中至少有一个元素的所有客户端"state"=="OH"