How to remove relatioships?

Hi, I can’t seem to figure out how to remove a relationship.

I have a very simple schema:

type User {
  id: ID!
  email: String! @id
  following: [User] @hasInverse(field: "followers")
  followers: [User] @hasInverse(field: "following")

and a GQL operations:

mutation followUser($id: ID!, $followUserId: ID!) {
    input: { filter: { id: [$id] }, set: { following: { id: $followUserId } } }
  ) {
    user {

mutation unfollowUser($id: ID!, $followUserId: ID!) {
  # ?

I can’t for the life of me figure out how to remove a relation. All relation operations seem to be additive.

Any suggestions?

Take a look at on how to delete edges.
You need to use a delete mutation. Specifically you’d use deletejson
Also take a look at for more examples.

Is there no way to do this via GraphQL and not DQL?

You can use the remove mtuation. Just use the remove keyword instead of set in your example and it’ll remove the edge you created with set.

Hope this helps.

1 Like

Exactly what I was looking for, thanks!