嗨,我尝试以这种方式使用羽毛服务填充我的数据表:
app.service('pupils').find({}, (error, result) => {
$('#pupils > table').DataTable({
"pageLength": view.short,
"lengthChange": false,
"info" : false,
"responsive": true,
"data": result.data,
"deferRender": true,
"columns": [ ... ]
});
});
我有超过100个测试记录,但在回调中我只收到10条记录。在羽毛服务中添加以下代码后,我收到更多记录:
paginate: {
default: 100,
max: 200
}
但我想禁用从mongo收到所有记录的分页。我怎样才能做到这一点?
要禁用分页,请删除paginate
选项。不建议用于生产,因为如果您尝试发送数千条记录,它可能会导致客户端和服务器都崩溃。
注意:响应对象会根据您是否使用分页而更改:
使用分页响应:使用data
数组属性的对象
{
total: 572,
limit: 50,
skip: 4,
data: [/* the data is here */]
}
没有分页的响应:数据数组
[/* the data is here */]