Filter by notIn return items anyway

System Information
  • Strapi Version: 5
  • Operating System: Windows 11
  • Node Version: 20.10.0
  • NPM Version: 10.2.5

Hi,

I have a collection type A that contains a relation many to many to a collection B. Now I want to filter a query on A in a way that it returns only items that do not contains [“itemBDocumentID”] of B.

Doing this the response effectively discard items containing only the relation to B item I want to discard, but if an A item is related with more than 1 B it return it.

Here is my graphql code :

query A(
  $filters: {
    "B": {
      "documentId": {
        "notIn": [
          "d54atxm6qutd6i9jj4ldvlr4"
        ]
      }
    }
  }, $locale: I18NLocaleCode) {
  A(filters: $filters, locale: $locale) {
    documentId
    B{
      documentId
    }
  }
}

And the response is :

{
  "data": {
    "A": [
      {
        "documentId": "vmofu4xoagclzd4995m4cci5",
        "B": [
          {
            "documentId": "ynwees3pjdrw0kztrtm0px0v"
          }
        ]
      },
      {
        "documentId": "zph962ax2a1fn9r8uqm0eh4f",
        "B": [
          {
            "documentId": "d54atxm6qutd6i9jj4ldvlr4"
          },
          {
            "documentId": "ynwees3pjdrw0kztrtm0px0v"
          }
        ]
      }
    ]
  }
}

We can see that the second A item contains the B item and another and is returned. How to discard items containing my unwanted B item ?