Skip to content

Error when creating new node

Yuvaraj edited this page Jul 21, 2023 · 4 revisions

I am creating a new node using C#, I used the following code.

await _boltGraphClient.Cypher.Merge("(memory:Memory { Id: {id} })") .OnCreate() .Set("memory = {newMemory}") .WithParams(new { id = newMemory.Id, newMemory }).ExecuteWithoutResultsAsync();

But I get error

Neo4j.Driver.ClientException: Invalid input '{': expected "+" or "-" (line 1, column 28 (offset: 27)) "MERGE (memory:Memory { Id: {id} })"

I also tried this

var result = (await (_boltGraphClient.Cypher .Create("(memory:Memory {newMemory})") .WithParam("newMemory", newMemory) .Return(memory => memory.As()).ResultsAsync)).FirstOrDefault();

I get the error Neo4j.Driver.ClientException: Invalid input '{': expected a parameter (line 1, column 23 (offset: 22)) "CREATE (memory:Memory {newMemory})" ^

Clone this wiki locally