Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create node with label using Neo4jClient in f#

I am trying to create a node and also assign a label to that node. Following the instructions in Using Neo4j Graph DB With F#, I managed to create the Person nodes, but I could not create a label Person for the node created. Is my use of the create method wrong? Do I need to pass it as a parameter? Could I use the Cypher create instead of create?

like image 215
cgio Avatar asked Feb 14 '23 13:02

cgio


1 Answers

The example uses the old API based way of using 'Create' so you used to do:

client.Create person

now you can (and should) use the Cypher version:

let createPerson person =
    client.Cypher
        .Create("(p:Person {param})")
        .WithParam("param", person)
        .Return<Person>("p")
        .Results
        .Single();

let pA = createPerson { Name = "PersonA"; Twitter = "tA" }

And you should be passing in the person as a parameter. Using the Cypher version is the only way to get labels into your db.

like image 190
Charlotte Skardon Avatar answered Feb 17 '23 02:02

Charlotte Skardon