查找未设置属性的Neo4j节点 [英] Find Neo4j nodes where the property is not set
本文介绍了查找未设置属性的Neo4j节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Cypher,如何找到不存在属性的节点?
Using Cypher, how can I find a node where a property doesn't exist?
例如,我有两个节点:
A = {foo: true, name: 'A'}, B = { name: 'B'}
现在,我想找到B,并根据未设置foo
属性的情况选择它.我该怎么办?
Now I'd like to find B, selecting it on the basis of not having the foo
property set. How can I do this?
推荐答案
正如迈克尔·亨格(Michael Hunger)所述
As Michael Hunger mentioned
MATCH (n) WHERE NOT EXISTS(n.foo) RETURN n
在Neo4j的旧版本上,您可以使用HAS:
On older versions of Neo4j you can use HAS:
# Causes error with later versions of Neo4j
MATCH (n) WHERE NOT HAS(n.foo) RETURN n
这篇关于查找未设置属性的Neo4j节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文