I realize when deleting nodes, there is no information returned like number of deleted nodes or even number of delete relationships.
Example query
CALL apoc.periodic.iterate('MATCH (u:User)
WHERE u.name IN $data
OPTIONAL MATCH (u)-[:OWNS]->(c:Car)
RETURN u, c',
'DETACH DELETE u, c', {batchSize:1000, params:{data:$data}})
In the above example, I want to return the number of user nodes deleted and number of car nodes deleted if it is possible with the additional info I get from using apoc.periodic.iterate
Thanks in advance.
You can YIELD the total value from the procedure call to get the total number of rows:
CALL apoc.periodic.iterate('MATCH (u:User)
WHERE u.name IN $data
OPTIONAL MATCH (u)-[:OWNS]->(c:Car)
RETURN u, c',
'DETACH DELETE u, c', {batchSize:1000, params:{data:$data}})
YIELD total
RETURN total
Based on your reply,
It only returns the total rows but doesn't return the total number of nodes deleted. In the query I have also match the user to car this is a one-to-many relationship thus I can be deleting a lot more nodes then rows. I would also like to know if possible the number of nodes deleted for each (i.e. number of nodes deleted for user and number of nodes deleted for cars).