Search code examples
neo4jneography

Clearing all neo4j data in Neo4j Beta 2.0.0-RC1


I was previously able to clear all the data in my graph with the following query:

"START n0=node(0),nx=node(*) MATCH n0-[r0?]-(),nx-[rx?]-() WHERE nx <> n0 DELETE r0,rx,nx"

But the release candidate of Neo4j 2.0.0 is no longer supporting ? for optional patterns and it's asking me to use OPTIONAL MATCH instead. I'm new to Neo4j so I'm a little stumped.

Any help clearing all my data would be really appreciated. Thanks.


Solution

  • The idiomatic Cypher for that is

    MATCH (n)  
    OPTIONAL MATCH (n)-[r]-() 
    DELETE n, r