Upsert for Record Update

What’s your idea?

Ability to use “upsert” when updating a record.

What problem might it solve?

Updating records where you don’t know if a child item exists. Especially useful in many to many table relationships. For example I have a “tags” table where a tag can be associated with many “socialPost” items. Currently I cannot use the “no duplicate values” toggle for the “tag” field in the table and have to deal with duplicates in other ways.

Have you seen it somewhere else?

Upsert Mutations - GraphQL (dgraph.io)

Any ideas on how you think it could/should work?

Example mutation below.

mutation ($id: ID!, $tag: String!) {
  socialPostUpdate(upsert: true, data: {
    id: $id, 
    tags: {create: {tag: $tag}}     
  }) {
    id
  }
}
1 Like

Hello!
Thanks for the feature request, we’ll add it to our roadmap to-dicuss list)