问题:我有2个集合,我必须执行连接,并希望预期的结果是可能在Arangodb中实现的?
collection 1 :[
{ id :1 , name: "jack" },
{ id :2 , name: "ryan" },
{ id :3 , name: "sam" },
{ id :4 , name: "rick" },
{ id :5 , name: "jackie" },
{ id :6 , name: "roman" },
{ id :7 , name: "soul" },
{ id :8 , name: "brad" }
]
collection 2 :[
{ id :1 ,age:12 ,standard: 5 },
{ id :5 ,age:14 ,standard: 7 },
{ id :7,age:15 ,standard: 8 }
]
预期结果:
[
{ id :1 , name: "jack",standard: 5 },
{ id :2 , name: "ryan",standard: 5 },
{ id :3 , name: "sam" ,standard: 5 },
{ id :4 , name: "rick",standard: 5 },
{ id :5 , name: "jackie",standard: 7 },
{ id :6 , name: "roman",standard: 7 },
{ id :7 , name: "soul",standard: 8 },
{ id :8 , name: "brad",standard: 8 }
]
FOR item in collection_1
FOR item2 in collection_2
FILTER item.id == item2.id
RETURN MERGE(item, item2)
您可以检查文档:https://www.arangodb.com/docs/stable/aql/examples-join.html