redisgraph.js - Parsing results of MERGE command

237 Views Asked by At

The documentation has the following example to merge relationships if all the end-points exist. If the MERGE were to be run in the Javascript client, then how can I find out, if the MERGE created the nodes and relationships or not? In other words, how can I deduce if the nodes were present beforehand or not?

At the moment, it seems, some methods of ResultSet for statistics might have to be used. Any thoughts?

GRAPH.QUERY DEMO_GRAPH
"MERGE (charlie { name: 'Charlie Sheen' })
 MERGE (wallStreet:Movie { name: 'Wall Street' })
 MERGE (charlie)-[r:ACTED_IN]->(wallStreet)"
1

There are 1 best solutions below

1
On

the result-set statistics will let you know how many nodes/edges were created, if none that means the pattern existed, otherwise merge created the pattern.