Reputation: 551
Here is the code...
var query = 'MATCH ( A:user { user_id:"user1"}) RETURN A';
var callback=function (err, res) {
if (err){
console.log(err);
}
else {
console.log("Sign in response:"+res);
console.log("Sign in response:"+res.columns);
}
};
var query_runner=require('./run_query2')
query_runner.run_query2(query,callback);
and The run_query method is defined as...
var run_query2=function(query,callback){
var neo4j = require('node-neo4j');
db = new neo4j('http://username:password@localhost:7474');
db.cypherQuery(query,callback);
}
module.exports.run_query2=run_query2;
NOTE:Creating a new entry works fine. And the MATCH query worked fine when I tried it in the browser. But when I try doing the same with the code, nothing gets returned. stuck here for 3-4 hours. HELP!
Upvotes: 2
Views: 156
Reputation: 41676
It looks at least in v2 that you have to provide a {query: "", params: {} }
object to the query function, see:
https://github.com/thingdom/node-neo4j/tree/v2#cypher
db.cypher({
query: 'MATCH (user:User {email: {email}}) RETURN user',
params: {
email: '[email protected]',
},
}, callback);
Upvotes: 1
Reputation: 775
Coding looks good. Similar happened to me and solved by changing the quotation. Can you try by changing the "" (quotation) sth like "MATCH ( A:user { user_id:'user1'}) RETURN A"
Upvotes: 1