我在ArangoDB有一个graph。如何创建具有指定_key值的边?我的代码:
edge_attributes = {"_key": "ab", "count": 0}
graph.createEdge(collection_edges_name, node_from_id, node_to_id, edge_attributes)我可以看到count以及_from和_to的适当值,但_key是某个随机数。
如何使用特定的_key创建边?我希望指定key来按key快速查询边,并防止从节点A到节点B的多条边。
发布于 2019-04-20 00:50:10
我为这个问题准备了一个变通方法。我使用带边的集合的指定名称创建Edge类的实例,然后调用:
edge_attributes = {"_key": edge_key,
"_from": parent_id,
"_to": node_to_id,
"count": 0}
edge = my_edges_collection.createDocument(edge_attributes)
edge.save()此解决方案使用正确的键和id创建文档。
https://stackoverflow.com/questions/55761897
复制相似问题