Remove property from Neo4j chart

I need to remove some node properties from my graph. Following the recommendations of cypher, I tried the following:

START n=node(1) DELETE n.property RETURN n 

An error message appears:

 Expression `Property` yielded `true`. Don't know how to delete that. 

I can reproduce this on console.neo4j.org. How should you remove the node property?

+6
source share
2 answers

What version of Neo4j are you using? Since Neo4j 2.0 (I don’t know exactly which milestone I tried it with M03), the properties are no longer β€œdeleted”, but β€œdeleted”:

 START n=node(1) REMOVE n.property RETURN n 

Should work with Neo4j 2.x.

This is also reflected in the documentation. On the right side of the page (perhaps after some loading time) you have a drop-down menu to select the version of Neo4j. When you go to the DELETE documentation and select the milestone 2.0.0-M03, you will notice that the menu item "Delete Property" disappears (link to the M03 documentation on DELETE: http://docs.neo4j.org/chunked/2.0.0- M03 / query-delete.html ).

Instead, the documentation for 2.0.0-M03 on REMOVE (here: http://docs.neo4j.org/chunked/2.0.0-M03/query-remove.html ) now displays the "Delete Property" section.

+10
source

One more example.

For Neo4j 3.0 , provided that the node with the property keys, name and age, the age property will also be removed:

Create node:

 CREATE (n {name:'Andres', age:25}) return n 

Delete property key age:

 MATCH (andres { name: 'Andres' }) REMOVE andres.age RETURN andres 

From the Neo4j 3.0 documentation https://neo4j.com/docs/developer-manual/current/cypher/#query-remove

+8
source

Source: https://habr.com/ru/post/950874/


All Articles