I am using the Upsert to Create or Update the node with Go Lang.
Here is my code
dg, cancel := getDgraphClient()
defer cancel()
ctx := context.Background()
req := &api.Request{CommitNow: true}
req.Query = `
{
me(func: eq(name, "Alice")) {
...fragmentA
}
}
fragment fragmentA {
v as uid
}
`
pb, err := json.Marshal(User{Uid: "uid(v)", Name: "Alice", Email: "user@mail.com"})
if err != nil {
log.Fatal(err)
}
mu := &api.Mutation{SetJson: pb}
req.Mutations = []*api.Mutation{mu}
if resp, err := dg.NewTxn().Do(ctx, req); err != nil {
log.Fatal(err)
}
return resp.Uids
When a node is created then I am getting those Uids but when it is updated then I am not getting Uids in response.
Is there any way I will get Uids in both conditions?