Data query with two levels of reference?

Hi, I am building a catalog site for a client. (for reasons off topic, I do not want to use Wix Stores)
I created a products collection, a category collection and an Images collection. The image collection references a product , which then references a category . I want to filter the images based on which category the referenced product is referencing.
I looked around and can’t seem to find anything on this
#wixdata #referenceFields #queryreference

Hi,

If you need to perform two queries to filter your results, I can suggest looking at the and() function in this case. Take a look at the and() function here and give it a test run with your code.

For information on testing and debugging your code, click here .

Best regards,
Edward

Hi @edwardl
Thank you for your response.
However, I don’t think this answers my question. I need to get information from the “grandchild” collection based on the grandfather collection. (images based on what collection the referenced product - in a different collection - is referencing).

To go the opposite way, would probably take way more time, but here is what would work the opposite way:
Query the desired category, query products based on the collection ID, loop through the products and then query the images based on each product ID.