如何禁用羽毛服务中的分页?

Sea*_*Dog 2 mongoose mongodb node.js feathersjs

嗨,我尝试以这种方式使用羽毛服务填充数据表:

app.service('pupils').find({}, (error, result) => {

    $('#pupils > table').DataTable({
        "pageLength": view.short,
        "lengthChange": false,
        "info" : false,
        "responsive": true,
        "data": result.data,
        "deferRender": true,
        "columns": [ ... ]
    });

}); 
Run Code Online (Sandbox Code Playgroud)

我有100多个测试记录,但在回调中,我仅收到10条记录。在羽毛服务中添加以下代码后,我收到更多记录:

paginate: {
   default: 100,
   max: 200
 }
Run Code Online (Sandbox Code Playgroud)

但我想禁用分页功能,以免收到来自mongo的所有记录。我怎样才能做到这一点?

Daf*_*aff 5

要禁用分页,请删除该paginate选项。但是,不建议用于生产环境,因为如果您尝试发送成千上万的记录,它可能会使客户端和服务器都关闭。

注意:响应对象根据您是否使用分页而变化:

分页响应:具有data数组属性的对象

{
   total: 572,
   limit: 50,
   skip: 4,
   data: [/* the data is here */]
}
Run Code Online (Sandbox Code Playgroud)

没有分页的响应:数据数组

[/* the data is here */]
Run Code Online (Sandbox Code Playgroud)