cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

How to set a new property value to some nodes of a type

darciosavilela
Node Clone

Let's say I have 50 person nodes and I set a new property like p.countryBorn = 'USA' for all. Later I notice 10 of person nodes actually are wrong and I need to update p.countryBorn value to 'Scotland'. How can I do that at once? I mean, I know p.name of 10 nodes, but I'm able to change one by one. Is it possible to set for 10 nodes at once?

tks,

Darcio

2 REPLIES 2

ameyasoft
Graph Maven
Try this:
with ["name1", "name2", "name3", "name4", "name5", "name6", "name7", "name8", "name9","name10"] as pnames

MATCH (p:Person)
where p.name in pnames
//check to see if this shows all the correct nodes
return p
//

//If results looks good...
set p.countryBorn = "Scotland"

Tks! It is working!