Update objects based on nested objects’ fields

What’s the most straight forward/recommended way of doing this w/ DGraph GraphQL:

https://hasura.io/docs/latest/graphql/core/databases/postgres/mutations/update.html#update-objects-based-on-nested-objects-fields

1 Like

Upserts in graphql are coming soon.

Not looking to upsert but rather:


type Account  {
  id: String! @id
  idFromSource: String!
}

type Detector  {
	id: String! @id
	account: Account!
    disabled: Boolean
    disabledBy: DisabledBy
}

I want to update all detectors where Detector.account.idFromSource == "some-id"

Yeah in Dgraph terminology, that’s an upsert. Unfortunate naming.

Ok, so just to be super clear - I want to update the detector, i.e. set Detector.disabled to true conditionally, and the condition is based on a field of the Account object referenced by the Detector, ie. Detector.account.idFromSource == "some-id"

Thx for following up

You could do this with an upsert in DQL in the meantime on a lambda: