Conditional upsert

I want to update the data when last_analysis_date is equal.

Below is my code, but it does not update my data.

	req := &api.Request{CommitNow: true}
	last := 1424943061
	req.Query = fmt.Sprintf(`{
		find(func: uid(0x1af8b0)){
					dv as uid
					last as last_analysis_date
	res := struct {
		UID          string `json:"uid"`
		VtResult     string `json:"vt_result"`
		LastAnalysis int    `json:"last_analysis_date"`
		UID:          "uid(dv)",
		VtResult:     "11111111111122222",
		LastAnalysis: last,
	pb, err := json.Marshal(res)
	if err != nil {
	req.Mutations = []*api.Mutation{
			Cond:      fmt.Sprintf(`@if(eq(val(last), "%d"))`, last),
			SetJson:   pb,
			CommitNow: true,
	_, err = dg.NewTxn().Do(context.Background(), req)
	if err != nil {

The cond operation supports len() only. You should check the val last with %d at the query level and use len() in the cond level.