Filtering by two array fields - one may be empty

I have a food database and I want to filter it by two parameters:

  • food type
  • initial age that baby can eat it for the first time

The query is as follows:

  foodItems(query: {foodGroup_in: ["vegetables", "fruits"], suggestionAge_in: [6, 9]}) 

The problem is that sometimes user may not apply both of the filters.

For example if the value for suggestionAge parameter is empty, the result of the query is also empty :slight_smile:
The expected result is query to return all food witch is in [“vegetables”, “fruits”] group :slight_smile:

How should I build this query?