How to replace a list in a mutation using Dgraph Cloud

UPDATE:

@charklewis - What you’re really asking is for the ability to pass in nested types. I think this should be a separate feature request, but may be fixed when nested filters are available one day.

Note: If you know the SEO ID (I imagine you do since you know the previous keywords), I believe you can avoid the other hassle by just updating the SEO node directly.

You can also avoid all types by using my easy-dgraph package.

Original Post


While we wait on an answer, I have some thoughts…

Since this is a foreign key problem, it is in relation to my @reference directive request, and perhaps should be added at the same time.

The difference, is that we are just dealing with the foreign keys, not the values themselves. We basically want to NOT merge the foreign keys on update.

I suggest this could be done in two ways:

1.) Going well with my other @reference suggestion:

Type Foo {
  id: ID!
  name: Bar @reference(merge: false)
  ...
}

2.) Or add a new setAll command to update all references…

mutation EditEntryMutation(
    $myKey: String
    $bar: Bar
  ) {
    updateEntry(
      input: {
        filter: { myKey: { eq: $myKey } }
        setAll: {
          bar: $bar
        }
      }
    ) {
      entry {
        urlKey
      }
    }
  }

J