Skip to content

Commit

Permalink
add example for usage of the limit parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
akatov committed Sep 15, 2017
1 parent 30f3aca commit bf5ed14
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,28 @@ export default Ember.Route.extend({
});
```

Limit to 5 documents.

```javascript
// app/routes/smasher/index.js
import Ember from 'ember';

export default Ember.Route.extend({
model() {
return this.store.query('smasher', {
filter: {
name: 'Mario',
debut: { '$gte': null }
},
sort: [
{ debut: 'desc' }
],
limit: 5
})
}
});
```

Note that this query would require a custom index including both fields `data.name` and `data.debut`. Any field in `sort` must also be included in `filter`. Only `$eq`, `$gt`, `$gte`, `$lt`, and `$lte` can be used when matching a custom index.

### store.queryRecord(model, options)
Expand Down

0 comments on commit bf5ed14

Please sign in to comment.