Dgo Mutation preds 1-\u0000 error during mutation

What Dgraph client (and version) are you using?

(put “x” in the box to select)

  • Dgo
    Version: v210

What version of Dgraph are you using? 21.03.1

When I run the following mutation

type Path struct {
				Title string `json:"Path.title,omitempty"`
							}
			p := Path{
				Title: "NewPath",
			}
			pb, err := json.Marshal(p)
			if err != nil {
				log.Fatal(err)
			}
			mu := &api.Mutation{
				SetJson: pb,
			}
			resp, err := txn.Mutate(ctx, mu)
			if err != nil {
				log.Fatal(err)
			}
{"c":{"txn":{"start_ts":145953,"keys":["sdbssh"],"preds":["1-\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000Path.title"]},"latency":{"parsing_ns":58475,"processing_ns":673067,"assign_timestamp_ns":480799,"total_ns":1271831},"metrics":{"num_uids":{"_total":2,"mutation_cost":2}},"uids":{"dg.842992234.11":"0xc367"},"hdrs":{"content-type":{"value":["application/grpc"]},"dgraph-toucheduids":{"value":["2"]}}}

I keep getting this response during mutation. How do I solve this?

Can you share the error? I don’t see one.

No nodes are created, but the uid is returned.

Have you added the predicate "dgraph.type": "Path"? If the UIDs are returned, that means the Node was created for sure.

Is it happening because I am using Graphql schema and have not configured it to suit DQL?
This is my schema in graphql

type Path  {
	id: ID! 
	nodes: [Node] @hasInverse(field:is_in_path) 
	title: String 
	owner: User 
}

And this is the schema shown in Dgraph Schema
image

So your mutation should be like

"Path.title": "NewPath",
"dgraph.type": "Path"

And you should be good to go.

1 Like