how to add a property to existing node neo4j cypher?

Your matching by label is incorrect, the query should be:

MATCH (n:User)
SET n.surname="Taylor"
RETURN n

What you wrote is: “match a user whose label property is User”.
Label isn’t a property, this is a notion apart.

As Michael mentioned, if you want to match a node with a specific property, you’ve got two alternatives:

MATCH (n:User {surname: 'Some Surname'})

or:

MATCH (n:User)
WHERE n.surname="Some Surname"

Now the combo:

MATCH (n:User {surname: 'Some Surname'})
SET n.surname="Taylor"
RETURN n

Leave a Comment

techhipbettruvabetnorabahisbahis forumu