问题
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