Dgraph Client mutation is not working?

Can someone help me with my first mutation in .NET with the DgraphClient? When i run the following i get an IsSuccess true response but i can’t find the object in the Dgraph database…

I copied exactly the same code from the example: GitHub - dgraph-io/dgraph.net: Official Dgraph .NET Client

using (var txn = this._client.NewTransaction())
var alice = new Person { Name = “Alice” };
var json = JsonConvert.SerializeObject(alice);

 var transactionResult = await txn.Mutate(new RequestBuilder().WithMutations(new MutationBuilder { SetJson = json }));


I once even created a “dgraph.type” = “Person” field in that Json object that i was sending and that didn’t work as well…

What are you doing to find your person entry in the database that is not working?

Also - I suggest starting with RDF instead of json and put some pretty explicit sets in there until you are comfortable. Eg: <0x01> <testfield> "Value" . and retrieve it with {q(func:uid(0x01)){testfield}}.

1 Like

I tried the follow mutation which doesn’t work. Querying works, but i am having trouble getting the mutations to work.

I also tried this from the documentation which doesn’t work:

var mutation = “_:alice < name > "Alice"”;
var transactionResult = await txn.Mutate(new RequestBuilder().WithMutations(new MutationBuilder{ SetNquads = mutation }));

I found the solution. I have to commit the transaction as well:

await txn.Commit();

Not really clear in their docs…

1 Like