apoc.merge.nodeWithStats.eagerProcedure
Syntax |
|
||
Description |
Merges the given |
||
Input arguments |
Name |
Type |
Description |
|
|
The list of labels used for the generated MERGE statement. |
|
|
|
Properties on the node that are always merged. |
|
|
|
Properties that are merged when a node is created. The default is: |
|
|
|
Properties that are merged when a node is matched. The default is: |
|
Return arguments |
Name |
Type |
Description |
|
|
The returned query statistics. |
|
|
|
The updated node. |
|
Example
The following query merges a Person node using id as the identifying property and name and age as on-create properties, returning the node alongside query statistics:
CALL
apoc.merge.nodeWithStats.eager(
['Person'],
{id: 1},
{name: 'Alice', age: 30},
{}
)
YIELD node, stats
RETURN
node.id AS id,
node.name AS name,
node.age AS age,
stats.nodesCreated AS nodesCreated,
stats.propertiesSet AS propertiesSet
| id | name | age | nodesCreated | propertiesSet |
|---|---|---|---|---|
1 |
"Alice" |
30 |
1 |
3 |
Produces the same result as apoc.merge.nodeWithStats.
The eager variant fully materializes all results before returning, which prevents conflicts when the procedure is used inside a larger
query that also reads or writes nodes matching the same labels and properties.