我想使用名称(而不是 ID)检查节点是否存在。 Cypher 查询看起来像:
MATCH (c:Jaguar{name:"JLR 2.5Ltr"})-[:REPRESENTED_BY]->(v) RETURN c IS NOT NULL
但是,使用 neo4j shell/web 控制台,返回的结果是 String 类型。同样在 spring-data-neo4j 中失败并出现错误:
Null return value from advice does not match primitive return type for: public abstract boolean xxx.yyy.repository.SomeRepository.checkIfDatasetExists(java.lang.String)
有没有人遇到过解决这个问题的方法
最佳答案
不幸的是,Supamiu 提供的答案不会起作用,您需要通过返回计数表达式来解决这个问题:
MATCH (c:Jaguar{name:"JLR 2.5Ltr"})-[:REPRESENTED_BY]->(v)
RETURN count(c) > 0 as c
关于java - 从 Neo4j 密码查询返回 boolean 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32761039/