$pow

Update records by setting the value of a numeric column to the result of raising its current value to a specified power. The $pow method is used to apply the exponentiation operation, where the current value is raised to a given power. For example, if the column value is 2 and the power is 3, the result will be 8 (2^3). This is useful for calculations that involve powers, such as growth calculations or scaling data.

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

Last updated