---
title: "entities(matching:mode:sortedBy:limit:)"
framework: appintents
role: symbol
role_heading: Instance Method
path: "appintents/entitypropertyquery/entities(matching:mode:sortedby:limit:)"
---

# entities(matching:mode:sortedBy:limit:)

Retrieves instances matching the supplied comparators.

## Declaration

```swift
func entities(matching comparators: [Self.ComparatorMappingType], mode: Self.ComparatorMode, sortedBy: [EntityQuerySort<Self.Entity>], limit: Int?) async throws -> Self.Result
```

## Parameters

- `comparators`: Array containing mapped values for comparators that entities need to match
- `mode`: Whether entity instances should match any or all comparators
- `sortedBy`: Array describing the query’s sorting order
- `limit`: Optional limit on the number of entity instances to return

## See Also

### Searching for entities

- [EntityPropertyQuery.Sort](appintents/entitypropertyquery/sort.md)
- [EntityPropertyQuery.ComparatorMode](appintents/entitypropertyquery/comparatormode.md)
- [EntityQueryComparatorMode](appintents/entityquerycomparatormode.md)
