简体   繁体   English

Neo4J Javascript 上的参数

[英]Neo4J Params on Javascript

I´m sure that one 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.我正在尝试使用“params”创建一个节点属性,但我必须遗漏一些东西,因为什么也没发生。 I neither received a console.log error, nor the param is working properly.我没有收到 console.log 错误,参数也没有正常工作。 I could console.log the requested variables, so that the request of the app is working, too.我可以 console.log 请求的变量,以便应用程序的请求也可以正常工作。

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);
        });

});

The comment of @fbiville helped me as a hint to get to an answer. @fbiville 的评论帮助我找到答案。 I changed the param of the property to props and now it works.我将属性的参数更改为道具,现在它可以工作了。 Thank you谢谢

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);

    });

});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM