Skip to Content
CypherQuerySET Clause

SET Clause

Overview

The SET clause is used to update properties on nodes and relationships in the graph database.The SET clause cannot update vertex ID, source ID, destination ID, or the primary key of a vertex.

The SET clause only supports updating nodes or relationships with a single label.

The SET clause cannot be followed by any other clause.

Examples

Set a property:

MATCH (p:Person {name: 'John'}) SET p.age = 30
MATCH ()-[a:Agent]->() SET a.age = 2025

Mutate specific properties using a map and +=

MATCH ()-[a:Agent]->() SET a += {name: "Tom", age: 30}

Replace all properties using a map and =

MATCH (p:Person) SET p = {name: "Tom", age: 30}
Last updated on