无法删除neo4j中的节点标签 [英] unable to delete node labels in neo4j
问题描述
我创建了2个标签,人,电影":
I have created 2 labels Person,Movies by :
CREATE (ee:Person { name: "test", id: "1" })
CREATE (m:Movie { name: "movie_1", id: "2" })
当我跑步时:
START n=node(*)
OPTIONAL MATCH (n)-[r]-()
DELETE n,r;
但是标签仍然存在.如何删除标签?
But The Label still exists. How can I delete the label?
推荐答案
因此,您实际上并没有delete
为它们remove
加上标签(例如,删除m:Movie). delete
用于从数据库中删除节点和/或关系.
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
查看参考卡neo4j.com/docs/stable/cypher-refcard/并搜索REMOVE
.
Check out the reference card neo4j.com/docs/stable/cypher-refcard/ and search for REMOVE
.
这篇关于无法删除neo4j中的节点标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!