Skip to content

Improve val() func inside upsert (JSON and Facets) #3940

@MichelDiz

Description

@MichelDiz

JSON mutation support seems to be missing:

{
    "query": "{ u as var(func: has(amount)) { amt as amount} me () {  updated_amt as math(amt+1)}}",
    "set": [
        {
            "uid": "uid(u)",
            "amount": {
                "uid": "val(updated_amt)"
              }
         }
    ]
}
{
  "errors": [
    {
      "message": "strconv.ParseUint: parsing \"val(updated_amt)\": invalid syntax",
      "extensions": {
        "code": "ErrorInvalidRequest"
      }
    }
  ],
  "data": null
}

Add val for facets in mutation.

ref: #1996

upsert {
      query {
        me(func: eq(email, "aman@dgraph.io")) {
          v as uid
          edge as someEdge @facets(r as rating, t as something, e as somethingElse)
        }
      }
      mutation {
          set {
            uid(v) <someEdge> uid(edge) (weight=0.1, updated_at=2019-06-02T13:01:09, val(r), val(t), val(e)) .
          }
      }
    }

As JSON

{
    "query": "{ u as var(func: eq(email, \"aman@dgraph.io\")) { edge as someEdge @facets(r as rating, t as something, e as somethingElse)}}",
	"set": [
		{
      "uid": "uid(u)",
      "someEdge|weight": "0.1",
      "someEdge|updated_at": "2019-06-02T13:01:09",
      "someEdge|rating": "val(r)",
      "someEdge|something": "val(t)",
      "someEdge|somethingElse": "val(e)"
		}
	]
}

Metadata

Metadata

Assignees

Labels

Check if resolvedarea/facetsIssues related to face handling, querying, etc.area/upsertIssues related to upsert operations.kind/bugSomething is broken.status/acceptedWe accept to investigate/work on it.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions