REMOVE

Updated at:

Use the REMOVE clause to delete a property from a vertex or an edge.

Cypher does not allow storing null in properties. When a property has no value, the property simply does not exist. REMOVE is therefore the correct way to delete a property — setting it to null is not valid syntax.

Remove a property

To remove a property from a vertex or an edge, specify the property reference after REMOVE:

SELECT *
FROM cypher('graph_name', $$
    MATCH (andres {name: 'Andres'})
    REMOVE andres.age
    RETURN andres
$$) as (andres agtype);

The vertex is returned without the age property:

                             andres
------------------------------------------------------------------
{id: 3; label: 'Person'; properties: {name:"Andres"}}::vertex
(1 row)

Terminal REMOVE clauses

A REMOVE clause with no subsequent clause is a terminal clause. A Cypher query that ends with a terminal clause returns no rows — but the cypher() function still requires a column list definition. Define a single dummy column; the variable will be NULL.