You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently calling .remove(null) on a service returns all removed documents.
// assuming we have a service called "books"awaitfeathers.service('books').create({title: 'The Lord of the Rings'})// this will return [{ title: 'The Lord of the Rings' }]awaitfeathers.service('books').remove(null)// this will also return [{ title: 'The Lord of the Rings' }]awaitfeathers.service('books').remove(null,{query: {$limit: 0})
While this is fine for a small number of removed documents, when the number get's higher (in our case 50k+)
things start to get very slow.
Is there a way to avoid this?
The text was updated successfully, but these errors were encountered:
@fmoessle The best way to avoid this until the library is updated is to use an after hook to unset the results. For example
// I wouldn't use $limit: 0 just yet. That may cause patch/remove to not// actually update any records? I know your example says it works and that is// good, but I am not sure thats the case for patch too? So I wrote this to use// $returning similar to feathers-sequelize until we can ensure $limit: 0 is// correct.consthandleMulti=(context)=>{const{ id, params }=context;if(id){returncontext;}// if (params && params.query && params.query.$limit === 0) {// context.result = [];// }if(params&¶ms.query&¶ms.query.$returning===false){context.result=[];}returncontext;};
MongoDB: 4.2.17
feathers-mongoose: 8.5.1
@feathers/feathers: 4.5.15
Hi!
Currently calling .remove(null) on a service returns all removed documents.
While this is fine for a small number of removed documents, when the number get's higher (in our case 50k+)
things start to get very slow.
Is there a way to avoid this?
The text was updated successfully, but these errors were encountered: