apoc.diff.relationships

Function APOC Full

Returns a Map detailing the property differences between the two given relationships

Signature

apoc.diff.relationships(leftNode :: NODE?, rightNode :: NODE?) :: (MAP?)

Input parameters

Name Type Default

leftRelationship

RELATIONSHIP?

null

rightRelationship

RELATIONSHIP?

null

Usage Examples

The examples in this section are based on the following sample graph:

MERGE (start1:Start)-[:REL_ONE {name: "Joe", dateOfBirth: datetime("1981-09-02")}]->(end1:End)
MERGE (start2:Start)-[:REL_TWO {name: "Ryan", twitter: "@ryguyrg"}]->(end2:End);
MATCH (:Start)-[relOne:REL_ONE]->(:End)
MATCH (:Start)-[relTwo:REL_TWO]->(:End)
RETURN apoc.diff.relationships(relOne, relTwo) AS output;
Table 1. Results
output
{
   "leftOnly":{
      "dateOfBirth":"1981-09-02T00:00:00Z"
   },
   "different":{
      "name":{
         "left":"Joe",
         "right":"Ryan"
      }
   },
   "inCommon":{

   },
   "rightOnly":{
      "twitter":"@ryguyrg"
   }
}