> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: queryReferenced(collectionId: string, item: any, propertyName: string, options: WixDataQueryReferencedOptions) # Method package: wixData # Method menu location: wixData --> queryReferenced # Method Link: https://dev.wix.com/docs/velo/apis/wix-data/query-referenced.md # Method Description: Gets the full items referenced in the specified property. The `queryReferenced()` function returns a Promise that resolves to the full items that are referenced in the specified property of the item from the specified collection. The Promise is rejected if the current user does not have read permissions for the specified collection or the collection containing the referenced items. For example, suppose you have a **Movies** collection with an **Actors** field that contains references to items in a **People** collection. Querying the **Movies** collection using `queryReferenced()` returns the relevant **People** items referenced in the **Actors** field of the specified **Movies** item. Meaning, it returns the full actor information for all actors in the specified movie. The `queryReferenced()` function can be used instead of a standard [`query()`](#query) with an [`include()`](https://dev.wix.com/docs/velo/api-reference/wix-data/wix-data-query/include.md) to overcome the limitations of the [`include()`](https://dev.wix.com/docs/velo/api-reference/wix-data/wix-data-query/include.md) function. You can optionally control the order of the returned referenced items by passing a `WixDataQueryReferencedOptions` object. > **Notes:** > - Calling the `queryReferenced()` function does not trigger any hooks. > - You can only use the `queryReferenced()` function with [multiple-item reference fields](https://support.wix.com/en/article/about-referencing-multiple-items-in-one-field), and not with single-item (regular) reference fields. > - The `queryReferenced()` function is not supported for Single Item Collections. > - To speed up data retrieval, the results of certain data requests are cached. Learn more about [caching data query results](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/data-api/about-caching-data-query-results.md). For a discussion of when to use the similar [`include()`](https://dev.wix.com/docs/velo/api-reference/wix-data/wix-data-query/include.md) function and when to use `queryReferenced()`, see [Querying Items that Reference Other Items](https://support.wix.com/en/article/including-referenced-data-when-filtering). # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Get referenced items ```javascript import wixData from 'wix-data'; // ... wixData.queryReferenced("movies", "00001", "actors") .then((results) => { if(results.items.length > 0) { console.log(results.items[0]); //see item below } else { // handle case where no matching items found } }) .catch((err) => { console.log(err); }); /* firstItem is: * * { * "_id": "12345", * "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb", * "_createdDate": "2017-05-24T12:33:18.938Z", * "_updatedDate": "2017-05-24T12:33:18.938Z", * "first_name": "John", * "last_name": "Doe" * } */ ``` ## Get referenced items using options ```javascript import wixData from 'wix-data'; // ... let options = { "order": "asc" }; wixData.queryReferenced("movies", "00001", "actors", options) .then((results) => { if(results.items.length > 0) { console.log(results.items[0]); //see item below } else { // handle case where no matching items found } }) .catch((err) => { console.log(err); }); /* firstItem is: * * { * "_id": "12345", * "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb", * "_createdDate": "2017-05-24T12:33:18.938Z", * "_updatedDate": "2017-05-24T12:33:18.938Z", * "first_name": "John", * "last_name": "Doe" * } */ ``` ---