I’ve following models
- Category
- Item
1st model is having a structure similar to parent-child, like Category & Subcategory.
Item is linked to Category/Subcategory.
I’m trying to filter all items that are linked to either Category or Subcategory.
For example:
Item 1 is linked to Cat1
Item 2 is linked to Subcat11 (Subcat11 is the child of Cat1)
I want both the items when I do pass Category as Cat1
. Can anyone please help?
Thanks in advance
hi @anshumansworld , welcome 
I suppose Category
is using a tree like structure:
And I suppose you are trying to filter records with GraphQL.
Am I right?
At the moment you cannot filter a record by a link field moving up its hierarchy. I think you should do two queries. One where you find all subcategories ids for a particular category and then another query where you filter Item
s based on Category
id and all of its subcategories ids. You can use the anyIn
graphql filter to do that.
Hope this helps 
1 Like