Finding nodes that do not have specific relationship (Cypher/neo4j)

前端 未结 2 1701
梦如初夏
梦如初夏 2021-01-07 19:49

I have a neo4j db with the following:

a:Foo
b:Bar

about 10% of db have (a)-[:has]->(b)

I need to get only the nodes

2条回答
  •  花落未央
    2021-01-07 20:38

    This also works if you're looking for all singletons/orphans:

    MATCH (a:Foo) WHERE not ((a)--()) RETURN a;
    

提交回复
热议问题