我有像
这样的N1QL查询SELECT RAW ARRAY_AGG(list.id)
FROM default list
WHERE list.type="list"
AND "*" IN list.supported
以下对象:
{
"type": "list",
"id": "*",
"name": "Everything",
"listCount": 2,
"supported": [
"*",
"test"
]
}
现在的问题是,我总是得到一个双数组:
[
[
"*",
"test"
]
]
我现在如何防止双数组结果或更好:如何在以下子选择中使用此结果(总是只返回一个空数组):
SELECT *
FROM default server
WHERE server.type="server" AND ANY listId IN supportedLists SATISFIES
listId in
(SELECT RAW ARRAY_AGG(list.id)
FROM default list
WHERE list.type="list"
AND "*" IN list.supported)
END;
服务器位于:
{
"type": "server",
"id": "AAABBBCCC",
"supportedLists": [
"0",
"1"
],
}
选择
SELECT *
FROM default server
WHERE server.type="server" AND ANY listId IN supportedLists SATISFIES
listId in
["test", "other features"]
END;
工作得很好......所以我的问题肯定是子选择
我想要存档的是拥有支持列表的服务器列表(字段supportedList),例如所有具有功能" test"的列表。 (支持字段)
答案 0 :(得分:1)
对于任何有相同问题的人......子选择应该用ARRAY_FLATTEN((SUBQUERY),1)包围
请参阅https://forums.couchbase.com/t/in-operator-is-not-working-for-subquery/11041/2