Archer
Archer

Reputation: 335

Why got an error when update property in neo4j

When I run this Cypher

CALL algo.randomWalk.stream(310467,3, 10) YIELD nodeIds 
with algo.getNodeById(nodeIds[3]) as node foreach (n in node| set n.cnt+=1)

I get

error:Neo.ClientError.Statement.SyntaxError: Invalid input '+': expected an identifier character, '.', whitespace, '(' or '=' (line 1, column 128 (offset: 127)) "CALL algo.randomWalk.stream(310467,3, 10) YIELD nodeIds with algo.getNodeById(nodeIds[3]) as node foreach (n in node| set n.cnt+=1)"

What is wrong with my syntax?

Upvotes: 0

Views: 100

Answers (1)

Tezra
Tezra

Reputation: 8833

+= is not a valid operator in Cypher. To increment by 1, you have to use the normal SET command, and set it to itself+1 like SET n.cnt = n.cnt + 1

Upvotes: 2

Related Questions