Neo4j SET(更新)节点属性错误

编程入门 行业动态 更新时间:2024-10-12 14:24:23
本文介绍了Neo4j SET(更新)节点属性错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用JavaScript设置(更新)Neo4j.我正在使用JavaScript语言驱动程序.

I'm trying to SET (update) a Neo4j using JavaScript. I'm using the JavaScript language drivers.

我的代码执行了,但是节点属性没有更新.

My code executes but the node properties do not update.

这是我的代码:

return session.run("MATCH (a:Person) WHERE a.ID = {id} SET a.name = {name}, a.email = {email}", { id: 114, name: name, email: email });

推荐答案

JavaScript数字是32位,Neo4j是64位,在设置或检索数字数据时需要执行一些转换.

Javascript numbers are 32 bit, Neo4j's are 64 bit, there's some conversion you'll need to perform when setting or retrieving numeric data.

在驱动程序自述文件中,这是相关部分.传递的数字将转换为浮点数,因此您需要通过neo4j.int()传递数字以将其强制为int类型,如下所示:

Here's the relevant section on this in the driver readme. The number being passed gets converted into a float, so you need to pass the number through neo4j.int() to force it to an int type like so:

return session.run("MATCH (a:Person) WHERE a.ID = {id} SET a.name = {name}, a.email = {email}", { id: neo4j.int(114), name: name, email: email });

更多推荐

Neo4j SET(更新)节点属性错误

本文发布于:2023-05-28 06:59:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/315184.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:节点   属性   错误   Neo4j   SET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!