-
Notifications
You must be signed in to change notification settings - Fork 75
Description
Multi-patch without $limit in params.query results in an incomplete operation, because filterQuery adds the default $limit: -1 to the request. Not sure if this problem exists in multi-remove as well.
I'll add this to feathers-sequelize and do a hacky PR for now. But the problem goes deeper, I think. I have something in mind for @feathersjs/adapter-tests and @feathersjs/adapter-commons:
Question 1: Is this something we should add to @feathersjs/adapter-tests? I saw there are tests for multiple items (count = 2) but not for many items, at least > 10.
I find this behavior of filterQuery from @feathersjs/adapter-commons quite confusing, although I understand, why it is like it is.
In another project I ended up deleting the default $limit: 10 from filterQuery(params) if params.query.$limit is not the same. Not the nicest solution, but the quickest.
Question 2: Is this maybe worth a property for second options argument of filterQuery? Something like: filterQuery(params, { addDefaultLimit: false }?
I will look into this in feathers-sequelize for now.
@daffl if you answered one of the two bold questions with "yes", I would be happy to help. Just let me know!
Steps to reproduce
The error comes from this line:
https://github.com/feathersjs-ecosystem/feathers-sequelize/blob/master/lib/index.js#L235
filterQuery adds $limit: 10 for default pagination, although no $limit is defined in params.
idList from https://github.com/feathersjs-ecosystem/feathers-sequelize/blob/master/lib/index.js#L232 has the full list of all items.
Expected behavior
this.service('posts').patch(null, { title: 'test' }, { query: { id: { $in: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] } } }) should patch 12 items and return 12 items
Actual behavior
patches 10 items and returns 10 items with default pagination:
"paginate": {
"default": 10,
"max": 100
},
System configuration
Module versions (especially the part that's not working):
"feathers-sequelize": "^6.2.0"
NodeJS version:
12