Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset / clear / delete neo4j database?

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.

How can we reset neo4j database such as newly created node will get id as 0?

From 2.3, we can delete all nodes with relationships,

MATCH (n) DETACH DELETE n 
like image 867
Somnath Muluk Avatar asked Apr 26 '14 11:04

Somnath Muluk


People also ask

How do I delete all constraints in neo4j?

Note using APOC you can drop all indexes and constraints via CALL apoc. schema. assert({}, {}) . Nice - that's amazing and quick!

What is the default database in neo4j?

The default database is named neo4j (can be changed) and is where we can store and query data in a graph and integrate with other applications and tools.

What is unwind in neo4j?

With UNWIND , you can transform any list back into individual rows.


1 Answers

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.

like image 118
Stefan Armbruster Avatar answered Sep 16 '22 20:09

Stefan Armbruster