0
votes

I am currently working with the neo4j sandbox and have a lot of nodes and relationships.

Now that I want to begin a new project and delete all those old nodes/relationships etc. - I can't find a "delete all"- or "reset"-Button.

Does anybody of you know how I can reset (delete all data stored online in) the sandbox?

Thank you for you answers in advance!

2

2 Answers

0
votes

The Cypher for this is

 MATCH (n)
 DETACH DELETE n;

DETACH DELETE is because a node must not have any relation for it to be deleted.

0
votes

The Cypher query above suggested by @jerome-b is perfect if you have small dataset but isn't enough for large amounts of data, see this.

This query isn’t for deleting large amounts of data, but is nice when playing around with small example data sets.

So, try this:

MATCH (n)
WITH n LIMIT 10000
DETACH DELETE n
RETURN count(*)

Run this until the statement returns 0 (zero) records. From the Official Neo4j documentation, they describe it as a best practice: Large Delete Transaction Best Practices in Neo4j.