简体   繁体   English

更新Cypher(neo4j)中的多个属性

[英]updating multiple properties in Cypher (neo4j)

I cannot update the node using SET for multiple properties in Neo4j, is there any way to handle this? 我无法使用SET来更新Neo4j中多个属性的节点,有什么方法可以处理吗?

start n=node:wordindex(word='repine') set     n.wordType = 'rare'         return n

If I want to add n.link = "..." how is that done? 如果我要添加n.link =“ ...”,该怎么做?

Here is the newest doc: http://neo4j.com/docs/developer-manual/current/cypher/clauses/set/ 这是最新的文档: http : //neo4j.com/docs/developer-manual/current/cypher/clauses/set/

 MATCH (n { name: 'Peter' })
 SET n += { hungry: TRUE , position: 'Entrepreneur' }

There are other ways also, so check the docs. 还有其他方法,因此请检查文档。

Also check this out if you are doing this from node.js : JSON.Stringify without quotes on properties? 如果您是通过node.js执行此操作的,还请检查一下: JSON.Stringify是否在属性上没有引号?

You can use util.inspect() to get an object in like this: 您可以使用util.inspect()来获取对象,如下所示:

 const util = require('util')

 const params = {
   hungry: TRUE ,
   position: 'Entrepreneur'
 }

 const query = `
   MATCH (n { name: 'Peter' })
   SET n += ${util.inspect(params)}
   RETURN n
 `
start n=node:wordindex(word='repine')
set n.wordType = 'rare', n.link='link'
return n

should do it 应该做

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

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