【问题标题】:Why is sails.js limiting responses by default?为什么sails.js 默认限制响应?
【发布时间】:2017-05-10 14:41:49
【问题描述】:

我在一个简单的 mysql 数据库之上创建了一个默认的sails.js 安装,其中包含所有默认选项。目前,我有一个包含 91 条记录的表。

我有一个 ionic 前端,可以加载该表中的列表,但它显示 30 条记录。

我使用邮递员点击了sails.js url (http://localhost:1337/list),显示返回了30条记录。

虽然这是重复的工作,但我直接在浏览器中点击了 url (http://localhost:1337/list),它仍然返回 30 条记录。

sails.js 将返回多少条记录是否有默认值?

如果是这样,我如何删除这个默认值,以便sails.js 将返回所有结果而不是子集?我不想分页,我想要完整的列表。

PS 我检查了我创建的sails.js 模型,以确认我没有任何时髦的限制性东西,而且它是超级准系统。

我没有自定义代码,整个sails.js 安装是默认的,减去数据库连接、骨架控制器和模型。

这是我的模型:

module.exports = {
identity: 'List',

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

【问题讨论】:

    标签: node.js sails.js


    【解决方案1】:

    您正在使用蓝图进行查找操作。 进入 config/blueprints.js 文件并检查所有 cmets...

    在那里你会发现:

      /****************************************************************************
      *                                                                           *
      * 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
    

    随心所欲地改变它。

    【讨论】:

    • 哇.. 我不敢相信我错过了。谢谢!
    猜你喜欢
    • 2020-05-11
    • 1970-01-01
    • 1970-01-01
    • 2015-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多