Cazineer
Cazineer

Reputation: 2405

Neo4j SET (update) node properties error

I'm trying to SET (update) a Neo4j using JavaScript. I'm using the JavaScript language drivers.

My code executes but the node properties do not update.

Here is my code:

        return session.run("MATCH (a:Person) WHERE a.ID = {id} SET a.name = {name}, a.email = {email}", {
            id: 114,
            name: name,
            email: email
        });

Upvotes: 1

Views: 66

Answers (1)

InverseFalcon
InverseFalcon

Reputation: 30397

Javascript numbers are 32 bit, Neo4j's are 64 bit, there's some conversion you'll need to perform when setting or retrieving numeric data.

Here's the relevant section on this in the driver readme. The number being passed gets converted into a float, so you need to pass the number through neo4j.int() to force it to an int type like so:

return session.run("MATCH (a:Person) WHERE a.ID = {id} SET a.name = {name}, a.email = {email}", {
            id: neo4j.int(114),
            name: name,
            email: email
        });

Upvotes: 1

Related Questions