I am writing a node js function which contains a cypher query to form a relation between two person node if they met each other. When they met decide by the exchange of Bluetooth packet.
Problem is when many Bluetooth packets received by server simultaneously, there are many MET relationship formed between two-person node.
My query look like this in psudo form
Match Person A with id X
Match Person B with id y
Optinal Match A and B has any MET relation in A-> B or B<-A
Then if no relation create A -[r:Met]-> B
if relation exist increse the count of met ( r.count++)
In any given case, there should be only one MET relationship in either A->B or B<-A.