mcsmcs
mcsmcs

Reputation: 3

What is the syntax for setting a property to a negative value?

I'm trying to set a property on a node to a negative number but am hitting syntax errors

Query

MATCH (n:SomeNode {myID:1})
SET n.myNegativeNumber=-1
return n

Error:

Invalid input '-' (line 2, column 24)
"SET n.myNegativeNumber=-1"
                        ^
(Neo.ClientError.Statement.InvalidSyntax)

I would add it as a string however I would like to be able to call sum/avg/etc on the property and it doesn't appear that those functions coerce the value to Number in my testing. Is there correct syntax to set the value as a Number?

Note: I'm trying this via the packaged web client as well as nodejs module seraph. Same result in both.

Upvotes: 0

Views: 172

Answers (1)

Nicole White
Nicole White

Reputation: 7790

You just need a space between the = and -:

MATCH n
SET n.myNegativeNumber = -1
RETURN n

Upvotes: 2

Related Questions