I have a mutation that updates an existing node. When I update with an existing uid, the api.Assigned struct does not have any uids returned, but does complete the update.
input := &model{
UID: "0x1234",
Name: "Test",
}
inputJson, err := json.Marshal(input)
if err != nil {
log.Println("error handing json marshal")
return nil
}
mu := &api.Mutation{
SetJson: inputJson,
CommitNow: true,
}
log.Println("mutation object:", mu)
txn := o.graph.NewTxn()
defer txn.Discard(ctx)
assigned, err := txn.Mutate(ctx, mu)
if err != nil {
log.Println("error handing mutation for update")
return nil
}
log.Println("assigned:", assigned.Uids)
if _, ok := assigned.GetUids()[string(input.ID)]; !ok {
log.Println("update unsuccessful")
return nil
}
The return of assigned.Uids is a blank map, but in the database, the Name has changed to “Test”. Is there something that I’m missing?