It looks very simple but I just can’t find the answer. I have a “Singers” collection and a “Songs” collection. The “Songs” collection has a “singer” field which is a reference to the “Singer” collection. Let’s say I want to write a query that finds all the songs that are performed by singers who are older than 20 (the Singer collection has an age field).
I need something like:
wixData.query(“Songs”).eq(“singer.age”).find() but that doesn’t work. I tried to use the “include” function but this only let me display the details of the singer AFTER the query is complete so it’s not a part of the query. What am I doing wrong?
Please help…
Thanks Dima, but what you did in this example is to display the Authors info AFTER the query. The question is what would you do if you wanted to query the books that were written by Charles Dickens for example, not how the query all the books and than show the info of their authors.
One way would be first finding all the books and only after run a loop that gets only the books of Dickens, but that would be highly inefficient…
@reggmil40204
I would say, depends on the structure of your DATABASE.
How is structured your DB ?
Already have seen this one? Perhaps this is also a possibility for you?
https://www.wix.com/velo/forum/coding-with-velo/want-to-call-multiple-items-from-database-according-to-user-selection-can-you-help
Can you show a good explained Screenshot of your DB-structure?
Relation between your DBs? You surely have several DBs which are related to each other?
I would assume, there are several ways of how to solve your problem, but all depends on your DB(DBs).