如何使用 Neo4J 上的密码查询删除特定节点的所有属性

How can I delete all the properties of a particular node using a cypher query on Neo4J

我需要获取节点的现有属性并删除除 id 之外的所有节点属性。

https://markhneedham.com/blog/2019/03/14/neo4j-delete-dynamic-properties/

上找到了答案
MATCH (n:person)
WITH n, [k in keys(n) where not k in ["id","_int_version"]] as keys
CALL apoc.create.removeProperties(n, keys) YIELD node
RETURN node;

最简单的方法实际上是在节点上设置地图(这会将节点的属性替换为地图中的属性,并确保地图仅包含您要保留的投影属性:

MATCH (n:person)
WITH n, n {.id, ._int_version} as propsToKeep
SET n = propsToKeep