Search code examples
cyphermemgraphdb

What is the correct way to remove property from node using Cypher?


I have found two ways to remove the property from the node. The first one is REMOVE n.name, and the second one is SET n.name= NULL.

Is there a recommendation for which of these two methods is better?


Solution

  • Usually REMOVE n.name is preferred. SET n.name = NULL might be useful especially if the value (null in this case) is provided by parameter and you don't know if it will be null or some actual value.

    More about: https://neo4j.com/docs/cypher-manual/current/clauses/set/#set-remove-a-property