DS#filter
DS#filter(resourceName[, params][, options])
Synchronously return a filtered, sorted and limited subset of items from the data store of the type specified by resourceName according to the criteria in params.
Arguments
| name | type | description |
|---|---|---|
| resourceName | string | The name of the resource to use. Unnecessary if using the resource directly. |
| params | object | Query parameters for selecting items from the collection. Default: {}. See Query Syntax for how to filter, sort, limit and offset. |
| options | object | Configuration options. Also passed through to DS#findAll if loadFromAdapter is true. |
| options.loadFromAdapter | boolean | Send the query to an adapter if it has not been sent yet. Default: false. |
| options.allowSimpleWhere | boolean | Treat top-level fields on the params argument as simple "where" equality clauses. Default: true. |
Examples
For many examples see the tests for DS#filter.
DS#getAll(resourceName) is a faster way of doing DS#filter(resourceName, {}).
Method Variants
You can call DS#filter in 2 ways:
- DS#filter(resourceName[, params][, options]);
- Resource#filter([params][, options]); // where Resource was created by DS#defineResource
Need help?
Want more examples or have a question? Ask on the Slack channel or post on the mailing list then we'll get your question answered and probably update this wiki.
Updated less than a minute ago
