查询两个顶点ID之间的边缘ID

时间:2017-07-08 17:48:36

标签: node.js orientdb orientdb2.2 orientjs

我有User个顶点和friends边缘。我知道有两个用户是朋友,其中一个想要与另一个用户取消联系。我怎么能删除给定顶点之间的边缘?

到目前为止,运行 DELETE EDGE FROM :player1 TO :player2 WHERE @class = "friends" DELETE EDGE FROM :player2 TO :player1 WHERE @class = "friends"(使用适当的params ofc。)以确保删除它对我来说很好但是感觉优雅不够。

1 个答案:

答案 0 :(得分:0)

您应该可以在一个查询中执行此操作:

 DELETE EDGE friends FROM [:player1, :player2] TO [:player1, :player2]

如果您还有从顶点到自身的边(例如,从player1到player1)并且您不想删除它们,则可以添加条件:

 DELETE EDGE friends FROM [:player1, :player2] TO [:player1, :player2]
 WHERE out <> in