How to get data from referenced collections.

If you have a collection that references another collection, and you want one query to retrieve data from both, use the .include() extension.

Here we have a Cars collection which references the Manufacturers collection using the ‘make’ field.

Use the name of the referencing field in a .include() in your query, and you get both collections returned in your results.

wixData.query("Cars")
    .include("make")
    .find()
    .then((results) => {
        console.log(JSON.stringify(results.items));
    });