> 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: fields(propertyName: Array) # Method package: wixData # Method menu location: wixData --> WixDataQuery --> fields # Method Link: https://dev.wix.com/docs/velo/apis/wix-data/wix-data-query/fields.md # Method Description: Lists the fields to return in a query's results. The `fields()` function returns only the specified fields in the query's results. You can use [`include()`](#include) in conjunction with `fields()` to get referenced items. When `fields()` receives an empty or invalid property, the query behaves as follows: + When no fields are specified, the query returns all fields. + When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned. + When only invalid fields are specified, only the default `_id` field is returned. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Add a fields function to a query ```javascript let myQuery = query.fields("fieldName1", "fieldName2"); ``` ## Create a query, specify fields to return, and run it ```javascript import wixData from 'wix-data'; // ... wixData.query("books") .fields("authorLastName", "title") .find() .then((results) => { let books = results.items; } else { // handle case where no matching items found } ) .catch((error) => { let errorMsg = error.message; let code = error.code; }); /* Items returned contain the _id field in addition to the requested fields. * [ * { * _id: '123', * authorLastName: 'Rowling', * title: 'Fantastic Beasts' * }, * { * _id: '456', * authorLastName: 'Melville', * title: 'Moby Dick' * } * ] */ ``` ---