Hello everybody. I have a bunch of collections connected through reference fields (some of them are single-item, others are multiple-item). Let’s say for example I have a collection Movies with references to Actors, Cinemas, etc.
Now I want to display a table with all the movies, with a column showing all the actors (comma separated), one column with all the cinemas and so on - pretty standard task I would say.
My question is: what’s the best way to retrieve the contents with Wix Data? In fact, query().include() only supports one property. Some posts suggest to use queryReferenced(), which is fine but I find it inconceivable to iterate over all results from query() with a for-loop, since I guess this would slow down the page terribly in production.
A for-loop would maybe make sense with pagination, but I don’t understand how I can use the default DataFetcher changing only the lines that display the content.
Seriously, I cannot believe there isn’t an efficient way to do it, joins are the most important operations in relational databases and no decent API would force you to do it with a for-loop.
Thank you in advance for your help