$toExponential

Update records by setting the value of a numeric column to its exponential notation with a specified number of decimal places. The $toExponential method is used to format a numeric value in scientific (exponential) notation. This is particularly useful when dealing with very large or very small numbers, ensuring the value is represented in a more compact and readable format. For example, a value like 1234567 could be converted to 1.234567e+6 when using $toExponential.

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

Last updated