$substr

Update records by extracting a substring from a column’s value. The $substr method is used to modify a string by selecting a specific portion of it, defined by a starting position and an optional length, allowing for precise manipulation of string data.

await Member.$update({
    $where: { 
        age: { 
            $eq: 16 
        } 
    },
    $update: {
       $substr: {
         username: 'bes'
       }
    }
});

Last updated