You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You duplicate Ann's node and create a new Mark node that was removed in xref:cypher/updating.adoc#_delete_a_node_and_its_relationships[the previous step] and a new `IS_FRIENDS_WITH` relationship between them.
259
+
The result is that you duplicate Ann's node and create a new Mark node (since it was removed in xref:cypher/updating.adoc#_delete_a_node_and_its_relationships[the previous step]) and add a new `IS_FRIENDS_WITH` relationship between them.
You see in the result that you "Created 2 nodes, created 1 relationship, set 2 properties, added 2 labels", so another duplication.
268
+
The result is more duplication.
269
+
`MERGE` tries to match the *entire* pattern, and if it doesn't exist, it is created.
269
270
This happens because `MERGE` tries to find the information queried and, if it doesn't exist, it is then created.
270
271
271
-
Even though the graph already has Ann and Mark's nodes, the pattern `(Ann)-[:IS_FRIENDS_WITH]->(Mark)` doesn't exist, so all elements of it are created anew.
272
-
Instead, you need to first `MATCH` the nodes and then create the relationship.
272
+
Even though the graph already has Ann and Mark's nodes, the pattern `(Ann)-[:IS_FRIENDS_WITH]->(Mark)` doesn't exist, so all elements are created anew.
273
+
To avoid the duplication, you need to first `MATCH` the nodes and then create the relationship.
273
274
274
275
Since Mark's node was removed in xref:cypher/updating.adoc#_delete_a_node_and_its_relationships[the previous step], you need to create it again either by using `CREATE`:
275
276
@@ -307,7 +308,7 @@ In order to create the new relationship, you need to first `MATCH` Ann and Mark'
0 commit comments