I am trying to increment a field in the database by a certain number using strapis query. I also want to do this using transaction.
I have found many articles and documentation that seem to be stale. I will paste them below.
// 'transacting' does not exist on query
await strapi.query('api::ticket.ticket').transacting(transacting).where('id', id).increment('value', order_ticket.quantity)
// 'where' does not exist on query
await strapi.query('api::ticket.ticket').where('id', id).increment('quantity', order_ticket.quantity)
// Expected a valid Number, got `quantity` + 2
await strapi.query('api::ticket.ticket').update({ 
  where: {
    id: order_ticket.ticket_id, 
  },
  data: {
    quantity: strapi.db.connection.raw(`?? + ?`, ['quantity', 2])
  }
}, null, { transacting });
References: