Skip to content

Instantly share code, notes, and snippets.

@joepindar
Created August 8, 2019 22:06
Show Gist options
  • Save joepindar/2b39495fac0a2a6826f2520943f90cf8 to your computer and use it in GitHub Desktop.
Save joepindar/2b39495fac0a2a6826f2520943f90cf8 to your computer and use it in GitHub Desktop.
Neo4J CYPHER queries to find and delete orphan nodes
// MATCH orphan nodes in Neo4J
MATCH (node)
WHERE NOT( (node)-[]-() )
RETURN node
// DELETE orphan nodes in Neo4J
MATCH (node)
WHERE NOT( (node)-[]-() )
DELETE node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment