Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-22-2021 09:43 AM
Hello,
I´m sure that someone of you can help me with this issue.
I´m trying to create a node property with "params", but I must be missing something, because nothing happens. I neither received a console.log error, nor the param is working properly.
I could console.log the requested variables, so that the request of the app is working, too.
Thank you for your help.
app.post("/person/originalname/add", function(req, res) {
var originalname = req.body.originalname;
var id = req.body.id;
session
.run("MATCH (n) where id(n) = $idParam SET n.original_name = $originalParam RETURN n", {
originalParam: originalname,
idParam: id
}
)
.then(function(result) {
res.redirect('/');
})
.catch(function(error) {
console.log(error);
});
});
Solved! Go to Solution.
03-09-2021 12:50 AM
I found the solution. In this case I needed to build a props{} to set it as property:
app.post("/person/originalname/add", function(req, res) {
var originalname = req.body.originalname;
var id = req.body.id;
session
.run("MATCH (n) where id(n) = $idParam SET n = $props", {
props: {
"original_name": originalname
},
idParam: id
})
.then(function(result) {
res.redirect('/');
})
.catch(function(error) {
console.log(error);
});
});
Thank you very much
03-08-2021 01:23 AM
Hi @arturo.guerrero ,
Tracking down these kinds of issues can be tricky. What happens when you directly run the query using Neo4j Browser? It can be helpful to debug in Neo4j Browser, both with and without parameters, then migrate the working query back into your app.
Best,
ABK
03-09-2021 12:50 AM
I found the solution. In this case I needed to build a props{} to set it as property:
app.post("/person/originalname/add", function(req, res) {
var originalname = req.body.originalname;
var id = req.body.id;
session
.run("MATCH (n) where id(n) = $idParam SET n = $props", {
props: {
"original_name": originalname
},
idParam: id
})
.then(function(result) {
res.redirect('/');
})
.catch(function(error) {
console.log(error);
});
});
Thank you very much
All the sessions of the conference are now available online