I am brand new to Cypher and just learning. The query below works and creates the records I want, but it seems unnecessary to repeat all of the properties in the CREATE statement:
WITH [
{id: 1, name: "Gold"},
{id: 2, name: "Banking"},
{id: 3, name: "Canada"},
{id: 4, name: "T.BMO", parentId: 2},
{id: 5, name: "Opinion"},
{id: 6, name: "BC", parentId: 3}
] AS tags
FOREACH (tag in tags | CREATE (:Tag{id: tag.id, name: tag.name, parentId: tag.parentId}))
I think it should be possible to write something like this instead, but I can't find the answer from the documentation:
WITH [
{id: 1, name: "Gold"},
{id: 2, name: "Banking"},
{id: 3, name: "Canada"},
{id: 4, name: "T.BMO", parentId: 2},
{id: 5, name: "Opinion"},
{id: 6, name: "BC", parentId: 3}
] AS tags
FOREACH (tag in tags | CREATE (tag:Tag))