Search code examples
mysqlstrapibulkupdate

Strapi. Bulk update on Mysql


How to do bulk update by Id, in Strapi using mysql database? I'm trying this

await strapi.query('logs').update({id_in : [12,13]}, {is_transfered : 1});

But getting this error

Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' 13 limit 1' at line 1

What is wrong?


Solution

  • This feature doesn't exist in update function that is offered by Strapi.

    But if you use strapi.query('logs').model you will have access to the Bookshelf instance.

    And if bookshelf supports this feature, then you will be able to bulk update.