Filter on a list of objects

Suppose I have a type MyType that has a field answers: [Answer].

I want to fetch all the object of type MyType that have an answer that ends up with ‘type1’ and an answer that ends up with ‘type2’ (so we need AT LEAST TWO answers). If I do the following it doesn’t work and it returns nothing because I think it checks that there is ONE answer ending up with ‘type`’ and ‘type2’ which is not possible:

filter: "endsWith(answers.id, 'type1') && endsWith(answers.id, 'type2')"

What is the correct way to do that?

can you try something like:

“!empty(answers.(endsWith(id, ‘type1’))) && !empty(answers.(endsWith(id, ‘type2’)))”

!empty() looks like it is returning false positives but this seemed to work for me:

MyType.fetch({
    filter: “exists(answers.(endsWith(id, 'type1'))) && exists(answers.(endsWith(id, 'type2')))”
})