Custom query to increment field

System Information
  • Strapi Version: 3.5.4
  • Operating System: MacOS
  • Database: Postgres
  • Node Version: 14.15.0
  • NPM Version: 7.11.1
  • Yarn Version: 1.22.10

Hello! trying to update a field using a custom query increment in vain! Nothing is happening. Any idea?

 .model.query((qb) => {
   qb.where("token", ctx.request.query.token);
   qb.increment("totalRequests", 1);

Well I hope after this time you have got answer but If not then actually your native approach is the first one I tried myself first for my update of a field in a model. But then tried the below slightly different approach

let updatedStatus = await strapi
            { id: data.alloc_emp },
            { emp_total_allocation: emp.emp_total_allocation + allocPercent }

the mistakeI made earlier is that for some reason we need to provide emp in emp.emp_total_allocation , i.e. we have to fetch the collection for which we want to update.

let emp = await strapi
          .findOne({ id: data.alloc_emp });