We can delete all nodes and relationships by following query.
我们可以通过以下查询删除所有的节点和关系。
MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r
But newly created node get internal id as ({last node internal id} + 1) . It doesn't reset to zero.
但是新创建的节点获得内部id为({最后一个节点内部id} + 1)。它不会重置为零。
How can we reset neo4j database such as newly created node will get id as 0?
我们如何重置neo4j数据库,例如新创建的节点将得到id为0?
From 2.3, we can delete all nodes with relationships,
从2.3开始,我们可以删除所有具有关系的节点,
MATCH (n)
DETACH DELETE n
2 个解决方案
#1
45
Shut down your Neo4j server, do a rm -rf data/graph.db
and start up the server again. This procedure completely wipes your data, so handle with care.
关闭Neo4j服务器,做rm -rf数据/图表。db并重新启动服务器。这个过程会彻底清除你的数据,所以要小心处理。
#2
0
If you are using it on a docker container, you can do
如果您在docker容器上使用它,您可以这样做
docker-compose rm -f -s -v myNeo4jService
docker-编写rm -f -s -v myNeo4jService
#1
45
Shut down your Neo4j server, do a rm -rf data/graph.db
and start up the server again. This procedure completely wipes your data, so handle with care.
关闭Neo4j服务器,做rm -rf数据/图表。db并重新启动服务器。这个过程会彻底清除你的数据,所以要小心处理。
#2
0
If you are using it on a docker container, you can do
如果您在docker容器上使用它,您可以这样做
docker-compose rm -f -s -v myNeo4jService
docker-编写rm -f -s -v myNeo4jService