嗨,我有我的有效载荷如下:
{
"Id": "3",
"List": {
"Steps": [
{
"StepId": "1",
"stepDesc1": [
{
"sortNo": "2",
"description": "ABC"
},
{
"sortNo": "1",
"description": "XYZ"
}
],
"stepDesc2": [
{
"sortNo": "2",
"description": "AAA"
},
{
"sortNo": "1",
"description": "BBB"
}
]
},
{
"StepId": "2",
"stepDesc1": [
{
"sortNo": "2",
"description": "CCC"
},
{
"sortNo": "1",
"description": "DDD"
}
],
"stepDesc2": [
{
"sortNo": "2",
"description": "EEE"
},
{
"sortNo": "1",
"description": "FFF"
}
]
}
]
}
}
我想按Id和StepId筛选,按SortNo排序并返回数据
我已使用以下查询按Id和StepId进行筛选
FOR test IN test_data
FILTER test.Id=='3'
FILTER '1' IN test.List.Steps[*].StepId
SORT test.List.Steps[*].stepDesc1.sortNo ASC
RETURN test.Steps
但第二个筛选条件不起作用,并返回与Id 3对应的所有步骤。在我的情况下,它应返回o/p以下
{
"StepId": "1",
"stepDesc1": [
{
"sortNo": "2",
"description": "ABC"
},
{
"sortNo": "1",
"description": "XYZ"
}
],
"stepDesc2": [
{
"sortNo": "2",
"description": "AAA"
},
{
"sortNo": "1",
"description": "BBB"
}
]
}
有谁能帮我解决问题吗
1条答案
按热度按时间xurqigkl1#
我相信你正在寻找的是这样的东西。因为你应用的第二个过滤器是真的
1
确实在数组中,但AQL并没有排除2
。它只是说1
必须存在。如果你循环嵌套数组-那么你可以使用==
。希望这能有所帮助。