简体   繁体   中英

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. Currently, I have a table with 91 records.

I have an ionic front end that loads the list in that table, but it's displaying 30 records.

I used postman to hit the sails.js url ( http://localhost:1337/list ) and that is showing 30 records returned).

While it's a duplicate effort, I hit the url ( http://localhost:1337/list ) directly in a browser and it still returns 30 records.

Is there a default to how many records sails.js will return?

If so, how do I remove this default so sails.js will return all the results rather than a subset? 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.

I have no custom code and the entire sails.js install is the default minus the db connection, the skeleton controller, and the models.

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...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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