gpt4 book ai didi

neo4j - 如何使用 Cypher Graph 查询语言删除 Neo4j 中的节点?

转载 作者:行者123 更新时间:2023-12-03 20:17:00 26 4
gpt4 key购买 nike

我想删除这个 Pessoa节点及其与其他节点的关系,
但我不想删除其他节点。

Node

这个节点有一个 Guid ID 属性值 c40f314f-0ecf-42e1-b44d-85b6d72f134a
我试过

MATCH (n {ID: 'c40f314f-0ecf-42e1-b44d-85b6d72f134a'}) DELETE n;

但是出现这个错误:

Neo.ClientError.Schema.ConstraintValidationFailed: Cannot delete node<35>, because it still has relationships. To delete this node, you must first delete its relationships.

最佳答案

使用

MATCH (n {ID: 'c40f314f-0ecf-42e1-b44d-85b6d72f134a'}) DETACH DELETE n;

Deleted 1 node, deleted 2 relationships, completed after 2 ms.



请注意,节点的关系也被删除了。

关于neo4j - 如何使用 Cypher Graph 查询语言删除 Neo4j 中的节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50377890/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com