Query Results
Retrieve filtered data with items(). Control result ordering with sort, limit data with pagination (start/count), and reduce payload size with projection.
Syntax
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sort.attributes | string[] | No | Fields to sort by (in priority order) |
sort.order | ('asc' | 'desc')[] | No | Sort direction for each attribute |
start | number | No | Zero-based offset for pagination |
count | number | No | Maximum items to return |
projection | object | No | { field: true/false } to include/exclude specific fields |
Return Type
Returns an array of items matching the query with applied options.
Usage Notes
- Without count, returns ALL matching items
- Always sort before paginating for consistent results
- Sort attributes and order arrays must have matching lengths
- Projection with true includes only specified fields
- Projection with false excludes only specified fields
- Use { $: true } in projection to include the item's key
- Deep property sorting works: sort by vendor.location.city
- Page formula: start = (pageNumber - 1) * pageSize
- See [Common Mistakes](/sdk/guides/common-mistakes) for pagination gotchas
Related Methods
Query Filter- Filter before retrieving resultscatalog.fn.facets()- Get facet counts for pagination UIcatalog.fn.aggregate()- Get totals without fetching items
Examples
Basic Result Retrieval
Get all items matching current query filters.
Pagination with count and start
Retrieve a specific page of results.
Single Property Sort
Sort results by one field.
Multi-Field Sort
Sort by multiple fields with different directions.
Sort with Pagination
Always sort before paginating for consistent results.
Field Projection
Select only specific fields to return.
Complete E-commerce Listing
Full example with filters, sort, pagination, and projection.
Sort by Deep Property
Sort results by a referenced entity property.