Return value after deleting node or relationship in neo4j

馋奶兔 提交于 2020-01-03 18:21:52

问题


I have experienced that when I delete some node (which may have relationships) or relationship in neo4j using cypher query, it do not give anything in return like in mysql db.

is there any way which can give the confirmation about the number of affected node (like number of node deleted) in cypher ?


回答1:


Below query works (I have tried this with neo4j 1.8.1 and 1.9.3 both community and enterprise version)

START root=node(1) MATCH root-[r:?]->() WHERE root.Id=12 DELETE r,root return count(root);  

We just need to make sure that node is not connected with any other relationship, if so delete those relationship prior to node as DELETE a,b,c,node where a, b and c are respective relationship connected with node.

Thanks @PeterNeubauer. :)



来源:https://stackoverflow.com/questions/18741000/return-value-after-deleting-node-or-relationship-in-neo4j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!