Nexorm
  • Getting Started
  • Schema
    • What is Schema?
    • Decorator's
  • Column
    • What is Column?
    • Decorator's
  • Core
  • Method's
    • Finder Method's
      • $search
      • $searchOne
      • $searchFirst
      • $searchById
      • $searchByIds
      • $searchAndCount
      • $distinct
      • $everything
      • $count
      • $query
    • Updater Method's
      • $update
      • $updateMany
      • $upsert
      • $restore
    • Creation Method's
      • $build
      • $buildMany
    • Deletion Method's
      • $delete
      • $deleteMany
      • $softDelete
      • $softDeleteMany
      • $truncate
  • Operator's
    • Search Operator's
      • $eq
      • $ne
      • $gt
      • $gte
      • $lt
      • $lte
      • $between
      • $notBetween
      • $in
      • $notIn
      • $like
      • $notLike
      • $startsWith
      • $endsWith
      • $substring
      • $and
      • $or
      • $is
      • $not
      • $overlap
      • $contains
      • $contained
      • $any
      • $regexp
      • $notRegexp
      • $iLike
      • $notILike
      • $adjacent
    • Update Operator's
      • String Operator's
        • $append
        • $prepend
        • $replace
        • $trim
        • $substr
        • $capitalize
        • $reverse
        • $slice
        • $lowercase
        • $uppercase
        • $camelcase
        • $kebabcase
        • $snakecase
        • $titlecase
      • Number Operator's
        • $inc
        • $dec
        • $mul
        • $div
        • $min
        • $max
        • $sqrt
        • $floor
        • $random
        • $abs
        • $ceil
        • $pow
        • $toFixed
        • $toExponential
        • $toPrecision
        • $round
        • $trunc
        • $mod
      • Boolean Operator's
        • $toggle
      • Object Operator's
        • $omit
        • $merge
        • $mapKeys
        • $mapValues
        • $invert
      • Array Operator's
        • $push
        • $pop
        • $pull
        • $addToSet
        • $sliceArray
        • $concat
      • Global Operator's
        • $set
        • $unset
        • $clear
    • Rules Operator's
    • Options Operator's
  • Hook's
    • $beforeCreate
    • $afterCreate
    • $beforeFind
    • $afterFind
    • $beforeUpdate
    • $afterUpdate
    • $beforeDestroy
    • $afterDestroy
    • $beforeSave
    • $afterSave
    • $beforeBulkCreate
    • $afterBulkCreate
    • $beforeBulkUpdate
    • $afterBulkUpdate
    • $beforeBulkDestroy
    • $afterBulkDestroy
Powered by GitBook
On this page
  1. Operator's
  2. Update Operator's
  3. String Operator's

$slice

Update records by extracting a specified portion of an string in a column. The $slice method is used to select a subset of elements from a segment of characters from a string, based on the provided start index and length. This is useful for working with arrays or strings where only part of the data needs to be modified or retrieved.

await Member.$update({
    $where: { 
        age: { 
            $eq: 16 
        } 
    },
    $update: {
       $slice: {
         username: { $begin: 1, $end: 5 }
       }
    }
});
Previous$reverseNext$lowercase

Last updated 2 months ago