VOOZH about

URL: https://www.javacodegeeks.com/2017/12/neo4j-cypher-property-values-can-primitive-types-arrays-thereof.html

⇱ Neo4j: Cypher – Property values can only be of primitive types or arrays thereof - Java Code Geeks


I ran into an interesting Cypher error message earlier this week while trying to create an array property on a node which I thought I’d share.

This was the Cypher query I wrote:

CREATE (:Person {id: [1, "mark", 2.0]})

which results in this error:

Neo.ClientError.Statement.TypeError
Property values can only be of primitive types or arrays thereof.

We actually are storing an array of primitives but we have a mix of different types which isn’t allowed. Let’s try coercing all the values to strings:

CREATE (:Person {id: [value in [1, "mark", 2.0] | toString(value)]})
 
Added 1 label, created 1 node, set 1 property, completed after 4 ms.

Success!

Published on Java Code Geeks with permission by Mark Needham, partner at our JCG program. See the original article here: Neo4j: Cypher – Property values can only be of primitive types or arrays thereof

Opinions expressed by Java Code Geeks contributors are their own.

Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy

Thank you!

We will contact you soon.

Tags
Neo4j
👁 Photo of Mark Needham
Mark Needham
December 7th, 2017Last Updated: December 6th, 2017
0 304 1 minute read
Subscribe

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Back to top button
Close
wpDiscuz