1

如果我有两个节点 ( self) 和friend_node,那么检查我是否已经知道我的两个节点的最有效方法是什么。

我根据您上次教我的内容构建了这个,但鉴于我知道我的节点在哪里,这似乎很复杂。有什么更容易的吗?

self.query_as(:user).match(friend: {uuid: friend_node.id}).where("NOT(user-[:friends_with]->(friend:User))").pluck(:friend) unless friend_node.blank?

4

1 回答 1

1

假设用户名为 有一个关联friends,只需执行user.friends.include?(friend_node).

于 2015-01-22T04:19:00.317 回答