neo4j.rb 检查两个节点之间是否已经存在关系
neo4j.rb check relation already exists between two nodes
我需要检查两个节点之间的关系是否已经存在。
brian.following << chris
brian.following
#=> chris
我需要这样检查
brian.following?(chris)
#=> true
brian.following?(john)
#=> false
neo4j.rb有什么方法吗?
如果没有,我如何在 Neo4j.rb-Rails 中为此编写自定义方法?
你可以brian.following.include?(chris)
。查看 https://github.com/neo4jrb/neo4j/wiki/Optimized-Methods, it details this and many other helpful methods that are either modified versions of those found in Enumerable and unique to QueryProxy. You'll also find examples of these in https://github.com/neo4jrb/neo4j/blob/master/spec/e2e/query_proxy_methods_spec.rb。
我需要检查两个节点之间的关系是否已经存在。
brian.following << chris
brian.following
#=> chris
我需要这样检查
brian.following?(chris)
#=> true
brian.following?(john)
#=> false
neo4j.rb有什么方法吗?
如果没有,我如何在 Neo4j.rb-Rails 中为此编写自定义方法?
你可以brian.following.include?(chris)
。查看 https://github.com/neo4jrb/neo4j/wiki/Optimized-Methods, it details this and many other helpful methods that are either modified versions of those found in Enumerable and unique to QueryProxy. You'll also find examples of these in https://github.com/neo4jrb/neo4j/blob/master/spec/e2e/query_proxy_methods_spec.rb。