1

I cannot update the node using SET for multiple properties in Neo4j, is there any way to handle this?

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

If I want to add n.link = "..." how is that done?

user2580874
  • 79
  • 1
  • 6

2 Answers2

10

Here is the newest doc: 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?

You can use util.inspect() to get an object in like this:

 const util = require('util')

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

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

should do it

Luanne
  • 18,815
  • 1
  • 38
  • 51