Neo4j SET(更新)节点属性错误 [英] Neo4j SET (update) node properties error
本文介绍了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(更新)节点属性错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文