$snakecase

Update records by converting a string column to snake case format. The $snakecase method is used to modify text fields by transforming the value into snake case, where words are separated by underscores and all characters are lowercase (e.g., “hello_world”). This is useful for formatting strings for database column names, API endpoints, or other cases where snake case is required.

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

Last updated