Im not able to use the params object to name a relationship between 2 nodes ,
Here is the code
var neo4j = require('neo4j');
var db = new neo4j.GraphDatabase('http://localhost:7474');
var params = {
name: {
firstname: "SRI",
lastname: "lanka"
},
relname: "country"
};
var query = [
'MATCH (location:PRIMARY {name:"location"})',
'CREATE UNIQUE (location)-[:{relname}]->({name})'
].join('\n');
db.query(query, params, function(err, results) {
if (err) throw err;
console.log(results);
});
Here is the error.How to make use of the params to name the relationship
Error: Invalid input '{': expected whitespace or a rel type name (line 2, column 28)
"CREATE UNIQUE (location)-[:{country
}]->({name})"
http://docs.neo4j.org/chunked/stable/cypher-parameters.html
Parameters can be used for literals and expressions in the WHERE clause, for the index value in the START clause, index queries, and finally for node/relationship ids. Parameters can not be used as for property names, relationship types and labels, since these patterns are part of the query structure that is compiled into a query plan.