Neo4j - convert set of node's attributes from string to int

Sergei Wallace picture Sergei Wallace · Feb 6, 2016 · Viewed 11k times · Source

If I have a set of nodes with the same attributes in Neo4j, is there a way to convert the type of a certain attribute from string to int (or vice versa) for all of those nodes?

Answer

Luanne picture Luanne · Feb 6, 2016

How about

MATCH (n:Type)
WHERE <filter if required>
SET n.strProp = toInt(n.strProp)

and

MATCH (n:Type)
WHERE <filter if required>
SET n.intProp = toString(n.intProp)