Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-02-2021 07:55 AM
Hello everyone!
I am working on a Ubuntu 18 installation of the Neo4j Community edition Server version . I currently have 2 databases called: neo4j and system. I understand from documentation and forums that for the community version we are only allowed to have 1 database, being the "system" database for other purposes.
I have previous data and indexes in the db "neo4j" I want to erase as I have started a new project from the database neo4j. I do not want to delete the database itself just the contents of it.
After several hours of research I came across a method of deleting the folders where the desired database is stored (neo4j/data/databases/db_to_erase.db), stoping the server beforehand and then restarting it, which in a misterious way will initialize the deleted database again from scratch. Some forums say to even delete the whole data folder (i.e neo4j/data). In both cases the default database is called "graph.db" instead of "neo4j" which is my case.
I have tried this method with no succes, apparently for versions 4.x.x this does not work and the name of the default database is also different as I stated earlier. I tried to delete just the "neo4j" database expecting that when I restarted the Neo4j server this would initialize it correctly since it is the default database. As I expected did this not happened as the database was listed as "unavailable" and "offline".
After a fresh installation, since the "neo4j" database was never restored to its original files, I decided to use the following command to delete all nodes in the database every time I wanted to clear my data:
MATCH (n)
DETACH DELETE n
This works, as my data is not really big, but it does not delete the indexes and it is obviously not the best way to do it. For now it is a good solution as I can work with my data but visually, the Neo4j browser still lists property keys and nodes from previous data even if they dont exist anymore, probably a bug in the UI.
I may have missed something in the documentation but I believe the current methods for deleting the contents of the database are not updated for the latest version which is required in my case because I am using the Graph Datascience Library which also depends on the latest Neo4j version.
If anyone could provide some insight into a solution for this I would be very grateful as I am not the only one in my working group who has this issue and one of them is an expert in graph database.
Thank a lot!! Hope you have a wonderful start of the year. Cheers
01-02-2021 10:53 AM
Deleting indexes is a separate step. (The documentation could be improved in that matter.)
CALL apoc.schema.assert({},{})
see:
All the sessions of the conference are now available online