Clear Neo4j Embedded database -


with new version of spring data neo4j can't use neo4jhelper.cleandb(db);

so, effective way completly clear embedded neo4j database in application?

i have implemented own util method purpose, method slow:

public static void cleandb(neo4jtemplate template) {     template.query("match (n) optional match (n)-[r]-() delete n,r", null); } 

how clear/delete database ?

updated

this similar question how reset / clear / delete neo4j database? don't know how programmatically shutdown embedded neo4j , how start after deleting.

i use spring data neo4j , based on user request i'd clear/delete existing database , recreate new data. how start new embedded database after suggested invocation of shutdown method ?

use case:

on working application have configured embedded database:

graphdatabaseservice graphdb = new graphdatabasefactory()                 .newembeddeddatabasebuilder(environment.getproperty(neo4j_embedded_database_path_property))                 .setconfig(graphdatabasesettings.node_keys_indexable, "name,description")                 .setconfig(graphdatabasesettings.node_auto_indexing, "true")                 .newgraphdatabase(); 

also, pre populate database 1000000 nodes. on user request need clear database , populate new data. how correctly , quick clear existing database ?

can call neo4j database api new node creation after database.shutdown() or need initialize new database before it?

see other answer on related question. inside of java, can shut down embedded database graphdatabaseservice#shutdown() method.

from there, there pile of different ways can delete underlying directory, see other answer.

so general answer can still same:

  1. shutdown database using neo4j java api
  2. delete database contents off of disk

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -