If we want to update all properties of the node, there is a practical shortcut:
MATCH (n {id: 1})
SET n = {id: 1, name: "My name", age: 30, address: "Earth, Universe"}
RETURN n
This leads to the following result:
{
"name": "My name",
"address": "Earth, Universe",
"id": 1,
"age": 30
}
In some cases, it might be painful to repeat existing properties to be sure not to erase the id, for instance. In that case, the += syntax is the way to go:
MATCH (n {id: 1})
SET n += {gender: "F", name: "Another name"}
RETURN n
This again works as expected, adding the gender property and updating the value of the name field:
{
"name": "Another name",
"address": "Earth, Universe",
"id": 1,
"gender": "F",
"age": 30
}