I have searched everywhere, but cannot find the answer to this.
I need to create a node Config that has a Properties object with 2 key/value pairs (name and type). The keys, when queried, should end up as properties.name and properties.type. But I cannot seem to get the create syntax right. This is what I'm doing:
CREATE (c1:Config) set c1.properties=[{name:"CiPipelineConfig1"}, {type:"test"}]
But that gives me some weird error:
Neo.ClientError.Statement.TypeError: Neo4j only supports a subset of Cypher types for storage as singleton or array properties.
Neo4j doesn't allow maps as properties (no sub-properties allowed, basically), and though lists are allowed as properties, they cannot be lists of maps (or lists of lists for that matter).
You can either use properties as-is on the node itself like (c1:Config {name:"CiPipelineConfig1", type:"test"}), or if you do need some means of grouping, create an additional connected node (or nodes) to hold the properties according to the grouping needed.
Or if they are just stored but not frequently used you can store them as JSON string.
APOC has a bunch of procedures/functions of automatically handling the conversions.
This topic reminds me of a Neo4j Blog Post about best and worst practices. About a half way through the post it talks about storing blobs of data in Neo4j. Technically yes you could store very large strings, strings a of JSON even, but be weary of doing so. Neo4j is a graph database not a document database. If you have a need to store documents whose data doesn't make sense being stored as a graph, I'd recommend a polyglot persistence solution: store your graph data and in the properties of the nodes store the URL/ObjectId of that data. Then leverage other databases such as MongoDB or AWS S3 Buckets to store the actual document itself. A good example, a user's profile image. You'd want your user nodes but I'd store the JPG binary in an S3 bucket.