![](/img/trans.png)
[英]Efficient ArangoDB AQL query that can find all Edges in Collection that go To and From the same Documents
[英]How to find common struct for all documents in collection?
我有一組文檔,它們或多或少具有相同的結構。 但我需要找到所有文檔中存在的字段。 有人認為:
{
"name": "Jow",
"salary": 7000,
"age": 25,
"city": "Mumbai"
},
{
"name": "Mike",
"backname": "Brown",
"sex": "male",
"city": "Minks",
"age": 30
},
{
"name": "Piter",
"hobby": "footbol",
"age": 25,
"location": "USA"
},
{
"name": "Maria",
"age": 22,
"city": "Paris"
},
所有文檔都有name
和age
。 如何使用 ArangoDB 找到它們?
您可以執行以下操作:
IE
LET attrs = (FOR item IN test RETURN ATTRIBUTES(item, true))
RETURN APPLY("INTERSECTION", attrs)
APPLY
是必需的,因此attrs
中的每個屬性列表都可以作為單獨的參數傳遞給INTERSECTION
。
文檔:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.