Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-11-2021 08:41 AM
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.
01-15-2021 11:37 AM
I've tried it with 4.2.0.0-all, and with a 4.0 version and it appears not to work in either.
4.2 version can be tested using dockerised neo:
docker run -p7474:7474 -p7687:7687 -e NEO4J_AUTH=neo4j/neo4k -e NEO4JLABS_PLUGINS=\[\"apoc\"\] neo4j
then running the cypher from the comment above
01-18-2021 07:54 AM
@neo4j11 the feature is not yet released, the docs are updated automatically by a process but they should not show that feature at this time sorry for the mistake.
I'll talk to the team to plan a new release ASAP but if you want in the meanwhile you can build it from the source.
Thank you so much!
Andrea
All the sessions of the conference are now available online