I have a string nodeType
which needs to be stored in neo4j as a node's label. In Cypher, this would be
CREATE (n:nodeType)
where nodeType
is a string set before this operation. In neo4jclient I have tried
.Create("(x:{type})")
.WithParam("type", nodeType)
but this is clearly not a correct usage of a parameter, and gives the error
Unhandled Exception: Neo4jClient.NeoException: SyntaxError:
Invalid input '{': expected whitespace or a label name
"CREATE (x:{type})"
^
Moving the label addition to a separate set operation gives the same error.
.Create("(x)")
.Set("x :{type}")
.WithParam("type", nodeType)
The official neo4jclient documentation on parameters says that "You can create parameters at any point in the fluent query..." but this does not seem to be the case, as the open bracket is not being treated as the start of a paramater by the Cypher engine. What am I doing wrong here?
Since string concatenation is a very, very bad idea, what is the intended method of setting a node's label from a variable in neo4jclient?