transform

transform.merge

merge(config: MergeConfig, options?: MergeOptions): Promise<TransformResult>

Merge nodes or edges that share the same values for the given key properties into a single representative survivor. All edges incident to deleted nodes are re-targeted to the survivor. Recorded in history as "MergeNodes" or "MergeEdges" and fully undoable.

Provide exactly one of category (to merge nodes) or relationship (to merge edges). Providing both or neither throws a TypeError.

configMergeConfigDiscriminated union specifying target category or relationship and the key properties that determine identity.
optionsMergeOptionsOptional: clearUnselectedProperties strips non-key props from the survivor; directional treats edge direction as part of the grouping key.

Returns: Promise<TransformResult>

Example

// Merge duplicate Person nodes by name
await api.transform.merge({ category: "Person", keys: ["name"] });

// Merge duplicate KNOWS edges (undirected)
await api.transform.merge({ relationship: "KNOWS", keys: [] });