Feathers: Is there a way to overide paginate from URL querystring or feathers client?

Created on 17 Jan 2017  ·  3Comments  ·  Source: feathersjs/feathers

In some case i need to return all data without pagination,
based on issue #219 i can do something like this

app.service('orders').find({paginate: false})

but its only work internally from the server side, not from the client,
may it will be nice if it can work from the client or from querystring like this

http://api.com/orders?$limit=-1
when service.paginate.max = false

or

http://api.com/orders?$paginate=false

Most helpful comment

By default this is disabled for good reasons (when you have several thousand records disabling pagination can bring down both, the server and the client) but it is possible to map the the query parameter to disable pagination as you suggested with a simple hook:

app.service('myservice').before({
  find(hook) {
    if(hook.params.query.$limit === '-1') {
      hook.params.paginate = false;
      delete hook.params.query.$limit;
    }
  }
});

All 3 comments

By default this is disabled for good reasons (when you have several thousand records disabling pagination can bring down both, the server and the client) but it is possible to map the the query parameter to disable pagination as you suggested with a simple hook:

app.service('myservice').before({
  find(hook) {
    if(hook.params.query.$limit === '-1') {
      hook.params.paginate = false;
      delete hook.params.query.$limit;
    }
  }
});

it works, thanks for youre fast response

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rstegg picture rstegg  ·  3Comments

Vincz picture Vincz  ·  4Comments

Mattchewone picture Mattchewone  ·  4Comments

harrytang picture harrytang  ·  3Comments

stephane303 picture stephane303  ·  3Comments