Forget about the "product" because it is a bad example. Let's use "office" instead.
What we want is "List all the zones that have at least one office for brand X in the zone".
For instance, with two zones,
France, and two brands,
Apple, I would like to query the zones where there is at least one
So if I have
- Office 1, Microsoft, France
- Office 2, Microsoft, Germany
- Office 3, Apple, France
I want a query that takes
Microsoft as an argument and would return
Germany zone documents, because both have at least one document of prismic-type
Office with a relationship to the
If the query argument is
Apple, it would only return the
What we do now is something like : query all offices related to the zone, map over the offices and if has a relationship to the desired brand, keep the related zone in an array (if not already in). Then we have all our zones for the brand.
But I would like to know if it is possible to to that directly in the query.
Sorry, this was a made up example, I don't remember the entities very well since I have not worked on that project for a while.