Some Arithmetic operators can be used to update data.

e.g - Let's say, you want to add 5 to price column in Products table

var rowsUpdated = await connection.update({
    in: "Products",
    set: {
        price: {
            '+': 5
        },
    },
    where: {
        id:1
    }
});
alert(rowsUpdated + ' rows updated');

Example

Supported operators are -


  • ' + ' : Add value to stored value
  • ' - ' : Substract value from stored value
  • ' * ' : Multiply with stored value
  • ' / ' : Divide with stored value by supplied value
  • ' {push} ' : Push an item to stored value. Works only if stored value is an array otherwise throws exception.