Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-14-2018 03:38 AM
I’m trying to change the property type of a node (from string to array):
match(d:Diagnosis) set d.diagnosis_tool = [d.diagnosis_tool] return d
but it its throwing this error:
Neo.ClientError.Statement.TypeError: Property values can only be of primitive types or arrays thereof
I don’t think it likes that the array only has one element, any ideas on how to achieve this?
Solved! Go to Solution.
09-14-2018 06:32 AM
Arrays cannot contain arrays - the message could perhaps be worded more clearly but it seems that in this particular case diagnosis_tool is already an array, and you're trying to create a nested array.
Example:
neo4j> create (d:Diagnosis) SET d.diagnosis_tool=[[1]] RETURN d;
Property values can only be of primitive types or arrays thereof
To limit your query to only those that are currently strings and not arrays, you might do something like this:
match (d:Diagnosis) where d.diagnosis_tool + '' = d.diagnosis_tool
WITH d as hasStringDiagnosisTool
SET d.diagnosis_tool = [hasStringDiagnosisTool.diagnosis_tool]
RETURN count(d);
09-14-2018 06:32 AM
Arrays cannot contain arrays - the message could perhaps be worded more clearly but it seems that in this particular case diagnosis_tool is already an array, and you're trying to create a nested array.
Example:
neo4j> create (d:Diagnosis) SET d.diagnosis_tool=[[1]] RETURN d;
Property values can only be of primitive types or arrays thereof
To limit your query to only those that are currently strings and not arrays, you might do something like this:
match (d:Diagnosis) where d.diagnosis_tool + '' = d.diagnosis_tool
WITH d as hasStringDiagnosisTool
SET d.diagnosis_tool = [hasStringDiagnosisTool.diagnosis_tool]
RETURN count(d);
All the sessions of the conference are now available online