graph databases - How to add collection of values for a bidirectional relationship properties in neo4j? -


i creating 2 nodes in neo4j directional properties below:
both employees calling each other , connected each other called relationship..

match (e1:emp),(e2:emp) e1.number='200' , e2.number='100' merge (e1)-[r:called]->(e2) set r.duration = ['233']     

and result below.

enter image description here

when creating relation in revrese direction :

match (e1:emp),(e2:emp) e1.number='100' , e2.number='200' merge (e1)-[r:called]->(e2) set r.duration = "235" +r.duration[0..]   

and result showing strange

enter image description here

how can add 2 properties in collection should

enter image description here

the concept of bidirectional exists when querying. when creating relationships, every relationship must have direction. have 2 different relations, 1 in each direction. relation emp 200 100 has property called duration value ['233'].

next, when create relation in opposite direction emp 100 200, relation new one, has nothing earlier relation except participating nodes same. in query

match (e1:emp),(e2:emp)  e1.number='100' , e2.number='200'  merge (e1)-[r:called]->(e2) set r.duration = "235" +r.duration[0..]   

r.duration null because duration property not yet exist on relationship r e1(100) e2(200).

if want add durations relationship in specific direction, use this

match (e1:emp),(e2:emp)  e1.number='100' , e2.number='200' merge (e1)-[r:called]->(e2)  set r.duration =["335"]+coalesce(r.duration,[]) 

note inserts new duration values array on relationship emp 100 200. values emp 200 100 unread , unmodified. if wish append values relationship in opposite direction, you'll have match first duration property. doing implies same property value on relation in both directions, , i'd question why need 2 relations instead of one.

if direction of no importance, use single relation between e1 , e2.