Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-14-2019 06:04 PM
I have inadvertently created nodes without any labels - but they do have IDs how do I delete them?
07-14-2019 10:06 PM
You can use the ID() function, such as:
MATCH (n)
WHERE ID(n)= [id to be deleted] //do not need the brackets just using for emphasis
DETACH DELETE n
This will delete the nodes with their respective relationships (if any).
Similarly, if the nodes are "valid", you could add their Labels and properties using their ID as well.
~Alfonso
07-15-2019 02:25 AM
If you don't have the IDs of the nodes, but you just want to delete any node without labels, then you can use this:
MATCH (n)
WHERE size(labels(n)) = 0
DETACH DELETE n
Depending on how many there are in the graph, and how many relationships they have, you may need to batch this so you don't blow your heap space.
All the sessions of the conference are now available online