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. Number Operator's

$sqrt

Update records by setting the value of a numeric column to the square root of its current value. The $sqrt method is used to modify numeric fields by applying the square root operation, which is useful in cases where you want to transform data, like calculating the square root of a number stored in the column.

await Member.$update({
    $where: { 
        age: { 
            $eq: 16 
        } 
    },
    $update: {
        $sqrt: {
          age: 2
        }
    }
});
Previous$maxNext$floor

Last updated 2 months ago