$div

Update records by dividing the value of a numeric column by a specified divisor. The $div method is used to adjust numeric fields by dividing the current value by a given number, commonly used for calculating averages, scaling values, or applying division-based transformations.

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

Last updated