问题
I have created 2 labels Person,Movies by :
CREATE (ee:Person { name: "test", id: "1" })
CREATE (m:Movie { name: "movie_1", id: "2" })
When I Run :
START n=node(*)
OPTIONAL MATCH (n)-[r]-()
DELETE n,r;
But The Label still exists. How can I delete the label?
回答1:
So, you don't actually delete
labels you remove
them (e.g. remove m:Movie). delete
is used to remove nodes and/or relationships from the database.
The following cypher example will match your movie node, remove the existing label, add a new one and return the node. When it is returned you can see that it has a different label.
match (m:Movie)
remove m:Movie
set m:FavouriteMovie
return m
Check out the reference card neo4j.com/docs/stable/cypher-refcard/ and search for REMOVE
.
回答2:
Labels not deleting are often caused by un-removed indexes.
For example, if you have an index personID
on the Person Node Label
DROP INDEX ON :Person(personID)
来源:https://stackoverflow.com/questions/28499175/unable-to-delete-node-labels-in-neo4j