> 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: data.items.queryReferenced(dataCollectionId: string, referringItem: any, field: string, options: WixDataQueryReferencedOptions) # Method Link: https://dev.wix.com/docs/sdk/business-solutions/data/items/query-referenced.md # Method Description: Retrieves the full items referenced in the specified field of an item. Reference and multi-reference fields refer to items in different collections. Use this method to retrieve the full details of 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()` retrieves the relevant **People** items referenced in the **Actors** field of the specified **Movie** item. This gives you information from the **People** collection about each of the actors in the specified movie. The `queryReferenced()` method returns a Promise that resolves to the full items 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. > **Notes**: > - You can only call `queryReferenced()` for [multi-reference fields](https://support.wix.com/en/article/about-referencing-multiple-items-in-one-field). > - This method does not support [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection). > - When calling `queryReferenced()` immediately following an update to your collection, the data retrieved [may not contain the most recent changes](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency.md). If you need the most up-to-date data, set `options.consistentRead` to `true`. > - To speed up data retrieval, the results of certain data queries 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). Learn more about [querying items that reference other items](https://support.wix.com/en/article/including-referenced-data-when-filtering). # Method Permissions: - Read Data Items # Method Permissions Scopes IDs: - SCOPE.DC-DATA.READ # Method Code Examples: ## Get referenced items ```javascript import { items } from "@wix/data"; async function queryReferencedItems() { const results = await items.queryReferenced("movies", "00001", "actors"); if(results.items.length > 0) { console.log(results.items[0]); //see item below } else { // handle case where no matching items found } } /* 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 { items } from "@wix/data"; async function queryReferencedItems() { const options = { "order": "asc" }; const results = await items.queryReferenced("movies", "00001", "actors", options); if(results.items.length > 0) { console.log(results.items[0]); // See below } else { // handle case where no matching items found } } /* 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" * } */ ``` ## default ```javascript try { const result = await items.queryReferenced("collection-0.3927776720545557", "6892593d-d57f-428d-bc53-3f0870a1beef", "refs", { consistentRead: true }); return result; } catch (error) { console.error(error); throw error; } ```