In the neo4j docs I can't find any mention of properties being deletable by setting to null, but it appears to work. Using this feature has the benefit of allowing PATCH request to our API which delete properties to use the same query, and execution plan, as PATCHes that only set properties; both scenarios just involve a
SET += $propertiesObject
Are there any downside to deleting properties by setting to null? If not, can it be added to the REMOVE section of the documentation as an alternative option?
Setting a property to null certainly does remove the property from the code as described here in the doc.
Might be worth a link to it from the
REMOVE section of the docs. Googling for 'delete a property from neo4j' and similar queries generally brings up results that use
We could add something more there.
In the meantime, we do have a Cypher knowledge base article which provides good detail for working with null values in Neo4j.
Thanks for the code! I had the same problem, got as far as the reference linked by Elaine but didn't test it. Glad to know it works. I agree it would be helpful if spelled out (and indexed) as the deletions of nodes and relationships all are. Thanks.
(The issue here, for me at least, is not so much working with null values as deleting a property or property labels; null values is the tool for doing so, but you wouldn't necessarily think to look there when your goal is "delete").