简体   繁体   English

默认情况下,为什么sails.js会限制响应?

[英]Why is sails.js limiting responses by default?

I created a default sails.js install with all default options on top of a simple mysql database. 我创建了一个默认的sails.js安装,其中所有简单选项都位于一个简单的mysql数据库之上。 Currently, I have a table with 91 records. 目前,我有一个包含91条记录的表。

I have an ionic front end that loads the list in that table, but it's displaying 30 records. 我有一个离子前端在该表中加载列表,但它显示30条记录。

I used postman to hit the sails.js url ( http://localhost:1337/list ) and that is showing 30 records returned). 我用邮递员打了sails.js url( http:// localhost:1337 / list ),它显示了返回的30条记录。

While it's a duplicate effort, I hit the url ( http://localhost:1337/list ) directly in a browser and it still returns 30 records. 尽管这是重复的工作,但我直接在浏览器中单击了URL( http:// localhost:1337 / list ),它仍然返回30条记录。

Is there a default to how many records sails.js will return? 默认情况下,sails.js将返回多少记录?

If so, how do I remove this default so sails.js will return all the results rather than a subset? 如果是这样,如何删除此默认值,以便sails.js将返回所有结果,而不是子集? I don't want to paginate, I want the full list. 我不想分页,我想要完整列表。

PS I have checked the sails.js model I created to verify I don't have any funky limiting stuff and it's uber barebones. PS我已经检查了我创建的sails.js模型,以验证我没有任何时髦的限制东西,并且它是超级准系统。

I have no custom code and the entire sails.js install is the default minus the db connection, the skeleton controller, and the models. 我没有自定义代码,整个sails.js安装是默认值减去db连接,骨架控制器和模型。

Here's my model: 这是我的模型:

module.exports = {
identity: 'List',

attributes: {
    id: {
        type: 'integer',
        primaryKey: true
    },
    name: {
        type: 'string',
        unique: true,
        required: true
    },
    user: {
        type: 'integer'
    }
    }
};

You are using blueprints for find action. 您正在使用蓝图进行查找操作。 Go inside config/blueprints.js file and check all comments... 进入config / blueprints.js文件并检查所有注释...

There you will find: 在那里您会发现:

  /****************************************************************************
  *                                                                           *
  * The default number of records to show in the response from a "find"       *
  * action. Doubles as the default size of populated arrays if populate is    *
  * true.                                                                     *
  *                                                                           *
  ****************************************************************************/
  // defaultLimit: 30

Change it as you prefer. 根据需要更改它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM