如何获得 Neo4j 中已经存在的约束?

Low*_*ory 3 neo4j graph-databases

当我在图表上创建了一些约束时,如何才能看到它们并消除它们?将它们视为图形元素的语法是什么?

Hyp*_*ive 7

要在 cypher 中执行此操作,您可以执行

CALL db.constraints;
Run Code Online (Sandbox Code Playgroud)

它给出了一个约束表,您可以name在执行时通过引用列来删除其中的条目

DROP CONSTRAINT constraint_name;
Run Code Online (Sandbox Code Playgroud)


Mic*_*ger 6

在 Neo4j 浏览器中,您可以使用:schema命令列出它们。在外壳中它是schema

然后你可以删除它们

`DROP INDEX ON :Label(prop)` 
Run Code Online (Sandbox Code Playgroud)

或者

`DROP CONSTRAINT ON (n:Label) ASSERT n.props IS UNIQUE`
Run Code Online (Sandbox Code Playgroud)


Aks*_*ale 6

在浏览器中,您可以使用 CALL db.constraints来获取图形上的所有约束。

欲了解更多信息:https://neo4j.com/docs/developer-manual/current/cypher/schema/constraints/


ino*_*ino 5

在 Neo4j 5.xx 中,它的SHOW CONSTRAINT命令。