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?

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

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
          .query("employee")
          .update(
            { id: data.alloc_emp },
            { emp_total_allocation: emp.emp_total_allocation + allocPercent }
          );
        console.log(updatedStatus);

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
          .query("employee")
          .findOne({ id: data.alloc_emp });