apoc.diff.nodes

Details

Syntax

apoc.diff.nodes(leftNode, rightNode)

Description

Returns a MAP detailing the differences between the two given NODE values.

Arguments

Name

Type

Description

leftNode

NODE

The first node to compare against the second node.

rightNode

NODE

The second node to compare against the first node.

Returns

MAP

Usage Examples

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

MERGE (joe:Person {name: "Joe", dateOfBirth: datetime("1981-09-02")})
MERGE (ryan:Person {name: "Ryan", twitter: "@ryguyrg"});
MATCH (joe:Person {name: "Joe"})
MATCH (ryan:Person {name: "Ryan"})
RETURN apoc.diff.nodes(joe, ryan) AS output;
Results
output

{leftOnly: {dateOfBirth: 1981-09-02T00:00Z}, inCommon: {}, different: {name: {left: "Joe", right: "Ryan"}}, rightOnly: {twitter: "@ryguyrg"}}