I would like to pass a variable (values from request body) as a parameter to the cypher query but i don´t know if (and how) this is possible. I´ve tried few things and a "normal" cypher query with hardcoded string parameter is working perfectly, but when I want to pass the variable as a parameter, I´ll get an error Structure(127, [[object Object]]). I´m on Neo4j 3.1. in combination with a node.js-server which builds the cypher queries.
This is a snippet..
var user_firstname = req.body.firstname;
var user_lastname = req.body.lastname;
var user_city = req.body.city;
session
.run("CREATE (n:Person {firstname: {firstname}, lastname: {lastname}, city: {city}})",
{ firstname: user_firstname,
lastname: user_lastname,
city: user_city })
Thanks in advance for your help, cheers!
user_*
variables strings, or are some of them objects? – cybersam