$trim

Update records by trimming leading and trailing whitespace from a column’s value. The $trim method is used to remove unwanted spaces from the start and end of a string, ensuring the value is clean and formatted without extra spaces. This is particularly useful for text-based fields.

await Member.$update({
    $where: { 
        age: { 
            $eq: 16 
        } 
    },
    $update: {
       $trim: {
        username: null
       }
    }
});

Last updated