简体   繁体   English

在ArangoDB中的两个文档之间添加边

[英]Add edge between two documents in ArangoDB

It should be easy operation but I can't find how to achieve this. 它应该是简单的操作,但我找不到如何实现这一点。 I have two documents from different collections and now I want to link them using new Edge from existing collection. 我有两个来自不同集合的文档,现在我想使用现有集合中的新Edge链接它们。 I'm trying to use edge-collection.save function like this: edge-collection.save(FOR s IN Sy FILTER s._key=403560128,FOR i IN Im FILTER i._key=353031872, points) but it doesn't work. 我正在尝试像这样使用edge-collection.save函数: edge-collection.save(FOR s IN Sy FILTER s._key=403560128,FOR i IN Im FILTER i._key=353031872, points)但它没有工作。 How can I do this? 我怎样才能做到这一点?

edge-collection.save() does not expect AQL statements as you are trying to insert. edge-collection.save()不会在您尝试插入时期望AQL语句。 It is expecting raw _id attributes for from and to and as a thir parameter a JSON Object containing additional data for the edge. 期望from和to的原始_id属性以及作为thir参数的JSON对象包含边缘的附加数据。 To store the edge described in your example you can execute the following command: 要存储示例中描述的边缘,可以执行以下命令:

edge-collection.save("Sy/403560128", "Im/353031872", points); ^^^^^ ^^^^^ ^^^^ sourceId targetId JSON

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM