$dec

Update records by decrementing the value of a numeric column. The $dec method is used to decrease the existing value of a column by a specified amount, typically used for fields like counters, quantities, or numeric metrics that need to be updated by reducing their value.

await Member.$update({
    $where: { 
        age: { 
            $eq: 16 
        } 
    },
    $update: {
       $dec: {
        age: 6
       }
    }
});

Last updated