Graphql Disconnect for many-to-many not working

Hi, I have the following query

mutation service {
  updateService(
    id: "279295423485575687"
    data: {
      name: "asdf service",
      active: true,
      approved: PENDING
      serviceCategoryL3: {
        disconnect: ["291691372022333953"]
      }
  }) {
    _id
    name

    serviceCategoryL3 {
      data {
        _id
        name
      }
    }
  }
}

which is mainly meant to disconnect Service from ServiceCategoryL3 but it does not seem to work, as can be seen from the query result

{
  "data": {
    "updateService": {
      "_id": "279295423485575687",
      "name": "asdf service",
      "serviceCategoryL3": {
        "data": [
          {
            "_id": "291691372022333953",
            "name": "Beatbox"
          }
        ]
      }
    }
  }

Am I doing something wrong here or is this a bug?

Also, if it helps here’s an except of the graphql schema

type Service {
  name: String!
  active: Boolean!
  approved: Approval!
  serviceCategoryL1: ServiceCategoryL1
  serviceCategoryL3: [ServiceCategoryL3] @relation
}

type ServiceCategoryL1 {
  name: String!
  services: [Service!] @relation
  serviceCategoriesL2: [ServiceCategoryL2!] @relation
}

type ServiceCategoryL2 {
  name: String!
  serviceCategoryL1: ServiceCategoryL1!
  serviceCategoriesL3: [ServiceCategoryL3!] @relation
}

type ServiceCategoryL3 {
  name: String!
  serviceCategoryL2: ServiceCategoryL2!
  services: [Service] @relation
}

@Sid It should disconnect. I will DM you for details to troubleshoot more.

Hi I am experiencing the same issue. I also have a many-to-many relationship that disconnect is not working for one of the resources in the relationship. The relationship is users who are subscribed to a region. Disconnecting the user from the region updates the user’s subscribedRegions correctly but does not update the regions subscribedUsers (I would have thought this happened automatically). Calling disconnect on the region to remove the user does nothing. Screenshots below - have an image of schema but only allowed to upload one item here :

![image|690x362]

While troubleshooting @sid schema, we found a bug with the disconnect in the many-to-many relationship scenario. I have raised a ticket.

1 Like

Okay great thanks for the info. I can work around for now and will look out for the fix in future releases.