cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Struggling to convert StringArray to String for name property after merge

mkretsch
Node Clone

Hello! I have encountered an issue. I use a specific query to merge nodes in my database

MATCH (a1), (a2)
WHERE id(a1) = {{"Source":node}} AND id(a2) = {{"Target":node}}
WITH head(collect([a1,a2])) as nodes
CALL apoc.refactor.mergeNodes(nodes,{
properties: "combine",
mergeRels:true
})
YIELD node
RETURN node

Since the properties combine, I receive output of StringArray for some properties, in particular the name property. When I try to group these name properties onto a new property, I essentially end up with a list that includes arrays, and it gives me "[Ljava.lang.String;@44cb54ce]"

There's two ways I can handle this. Either I can convert these string arrays to strings. However, apoc string convertor does work on this because I end up with this:

apoc.convert.toString(a.name)
"[Ljava.lang.String;@7e5b8532"

The other way would be to identify all the StringArray names and set the names again as lists (export the list, and then reimport them). However, I'm not sure how to MATCH on the fact a property (in this case the name property) is type StringArray.

Any ideas?

1 REPLY 1

you can turn them into strings e.g. with apoc.text.join(a.name,",")