Neo4J 按 ID 获取节点

我在我的一个项目中使用 neo4j,有一个节点只有一个属性 name,我想使用 ID 来获得这个节点,它已经有了一个 ID,但是当我使用这个代码时

MATCH (s:SKILLS{ID:65110}) return s

它什么也不返回,这是我的节点

enter image description here

如果查询是错误的,那么我如何使用数字查询它

83269 次浏览
MATCH (s)
WHERE ID(s) = 65110
RETURN s

The ID function gets you the id of a node or relationship. This is different from any property called id or ID that you create.

you can say:

(n:User) where id(n) >=20 RETURN n

this will return all nodes of type User with node reference ID more than 20

START should only be used when accessing legacy indexes. It is disabled in Cypher 2.2 3.2 and up.

Neo4j recommends using WHERE ID(n) = , and furthermore states that it will only require a single lookup (does not scan every node to find the matching ID)

WARNING
The answer below is incorrect. It is listed for reference only. See the updated answer above (quoted). The text below is kept for reference only

You can use WHERE ID(s) = 65110, but this will check the ID of every node in your database.

There is a more efficient way to do this:

START s=NODE(517) MATCH(s) RETURN s