How to delete or patch multiple items in feathersjs

There are conditions where you need to bulk delete or patch operations in feathersjs

TLDR

  • Update the service to activate multi
  • set null as id for service call

Updating the service

The multi option is already there in feathersjs. For security purposes it is disabled by default. To enable it go to the specific service and add the multi option in the options parameter. see the docs for more details

The multi option is available for create, patch and remove.

Sending the request for delete

If you are using the feathers client then send the query params. For example if you need to delete a set of users with ids

See the null as id for first parameter instead of single id.

This is the signature of the patch and remove methods. Remove has NullableId as type and params as second argument

Patch

This is also possible for patch request with data as the second argument

Hope this helped you

safaldas

safaldas