Way to make updates in bulk, for one specific fiel on each specific content-type

There are roughly 2 or 3 ways to make bulk updates but none of them are directly native to Strapi:

The simplest way is simply performing a loop on the client side, this provides the best fault tolerance to the frontend, where in case of a failure it wouldn’t entirely stop the process and errors with specific entries could be handled gracefully with ease.

The following two require custom controllers/routes within Strapi:

  • Either you do the same loop but server-side where the client basically just sends a payload that is an array of objects. This is slower since you couldn’t utilize load balancing and handling errors is not as simple (how do you tell the client that 2/10 in the array had errors?)
  • The other method involves more custom logic in a controller which could utilize custom queries (aka bypassing strapi logic) and doing an actual database level bulk insert/update, it’s at this point where you could probably parse a CSV and convert it to the structure needed in a custom query. This would be the fastest method but would pose the same error handling problem. It’s also the most complex to do.
1 Like