Multi-predicate upsert?

Hi All,

Is it possible to use more than one predicate as an input to upsert? For example, modifying the example at https://docs.dgraph.io/query-language/#upsert, would it be possible to consider more than one predicate as a criteria for the upsert? Say we need “Steven Spielberg” in more than one namespace…can we do something like the following to get more specific?


{
  a as var(func: eq(Name, "Steven Spielberg")) @filter(eq(Namespace, "Different Domain")) @upsert
}

mutation {
  set {
    uid(a) <age> "70" .
  }
}

This isn’t possible at the moment. You should get back an error message saying "Upsert query cannot have filters.".

If this functionality is something you would find useful, please raise a github issue and we can take a closer look.

Got it - thanks. I’ll sit on this one for now because I’m not sure yet if I really need the feature. I will submit an issue later after I’ve worked more on the use case if I think it would add a lot of value.

1 Like

We’re adding support for transactions.

Once they’re released in v0.9, you can achieve what you need easily without upsert. For that matter, there won’t be any upserts in v0.9; because txns would provide a super set of upsert functionality.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.