Search code examples
c#neo4jneo4jclient

Try to save to neo4j DB with new Neo4jClient in Core App


Im using the new neo4j Client from https://www.nuget.org/packages/Neo4jClient/4.0.0.1-prerelease, now I would like to use parameters like from https://github.com/Readify/Neo4jClient/wiki/cypher-examples

in my C# App and try to save a new node Person with:

    private async Task CreatePerson(IGraphClient client, params Person[] persons)
    {
            client.Cypher
            .Unwind(persons, "person")
            .Merge("(p:Person { Id: person.Id })")
            .OnCreate()
            .Set("p = person")
            .Return(person => person.As<Person>());
    }

I can run the Query but I didnt receive any Data and Im not getting any Error, what Im missing here?

Thank you and best regards

UPDATE: Added Return Statement


Solution

  • You are executing your query with the ExecuteWithoutResultsAsync method, which does not return results (and your code does not attempt to handle a result from the method anyway).

    To get results, your generated Cypher must RETURN a result, and you need to use the Results method to get the results of the query. In addition, your code should actually use the result in some way.

    Refer to the documentation for more details.