cancel
Showing results for 
Search instead for 
Did you mean: 

Existing properties wiped by setting new properties on a node - Is this expected behavor?

Koen_Algoet
Node Clone

I created notes according (+/- 400) :

Only property is the name.

CREATE (q375:BouyConnection {Name: "BM90.2"})
CREATE (q376:BouyConnection {Name: "BM91.1"})
CREATE (q377:BouyConnection {Name: "BM91.2"})
CREATE (q378:Connection {Name: "V4.3"})
CREATE (q379:Connection {Name: "V5.3"})
CREATE (q380:Connection {Name: "V6.3"})

I did merge relationships ( 10000 )

MATCH(Source:Connection {Name:"V6.3"}),(Target:Pipe{Name:"BT_01"})MERGE(Source)-[r11:CanInjectButane]->(Target);
MATCH(Source:Pipe {Name:"BT_01"}),(Target:Pipe{Name:"BT_PV01"})MERGE(Source)-[r21:CanInjectButane]->(Target);
MATCH(Source:Pipe {Name:"BT_PV01"}),(Target:Pump{Name:"P1101"})MERGE(Source)-[r31:CanInjectButane]->(Target);
MATCH(Source:Connection {Name:"V6.3"}),(Target:Pipe{Name:"BT_01"})MERGE(Source)-[r41:CanInjectButane]->(Target);

Now I do a set p= {property : value ,property : value ,property : value } expecting to be setting additional properties.

After doing so it seems I lost my existing properties on all nodes. ( and gives me a hart attack)

Only nodes with I did not do a set properties on , are not changes. (logic)

Koen_Algoet_0-1660138564339.png

Any option to recover my old Name property?

Using latest versions. Newbee on the block.

 

1 ACCEPTED SOLUTION

glilienfield
Ninja
Ninja

You need to use 'set p += {property : value ,property : value ,property : value }' if you want to update just those properties.

From the Neo4j Cypher Reference card:

Add and update properties, while keeping existing ones

SET n += $map

View solution in original post

2 REPLIES 2

Koen_Algoet
Node Clone

I'm futher investigating and indeed using a set {prop:value } removes not listed properties. 

I'm doomed.

Looking if there is a 'undo' scenario but I expect not. So my model is still there but I'm missing all my node names... 

glilienfield
Ninja
Ninja

You need to use 'set p += {property : value ,property : value ,property : value }' if you want to update just those properties.

From the Neo4j Cypher Reference card:

Add and update properties, while keeping existing ones

SET n += $map