Hi all,
Looking at the documentation for mergeNodes it seems that properties that are merged to create a single element array can be coerced into an atomic value (the default), or kept as a single-element array if the singleElementAsArray config is set to true (see "config properties" table on referenced page).
When attempting to merge nodes in a very simple graph:
merge (:ToMerge {prop1: ['single array'], prop2: 'atom'})
merge (:ToMerge {prop1: ['single array'], prop2: 'alone'})
... using the cypher:
match (n1:ToMerge {prop2: 'atom'})
match (n2:ToMerge {prop2: 'alone'})
with [n1, n2] as nodes
call apoc.refactor.mergeNodes(nodes, {properties: "combine", singleElementAsArray: true}) yield node
return node
A single merged node results (as expected); on this node prop2
is ['atom', 'alone']
(also as expected) but prop1
is 'single array'
rather than ['single array']
as I expected (the single element array is converted to an atomic value).
I'm not sure if this is a user error or a documentation issue; any help appreciated.