How to delete all nodes in neo4j?

I tried

session.run(`match (n) delete n`)

but it didn't work.

Is it because the Javascript driver has similar features like" If you need to delete some large number of objects from the graph, one needs to be mindful of the not building up such a large single transaction such that a Java OUT OF HEAP Error will be encountered." in Large Delete Transaction Best Practices in Neo4j - Knowledge Base

@userJustin

but it didn't work.

how so? it errored? it hung? the statement completed but didnt do what was expected?

Also, what version of Neo4j is in play here. If 4.4.x or 5.x you can

Hi there!

Refer to this other thread where I answered how to delete all nodes and relationships in a graph.

--> Efficiently delete all the nodes and edges of a very large graph

Either approach I proposed in this thread will work for you.

If you have access to all of APOC procedures, CALL apoc.periodic.truncate() will also remove all entities (and optionally indexes and constraints) from the database. - reference apoc.periodic.truncate - APOC Documentation (neo4j.com)

Cheers,
Rob