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

$floor

Update records by setting the value of a numeric column to the largest integer less than or equal to its current value. The $floor method is used to modify numeric fields by rounding down to the nearest whole number, ensuring that values are always rounded down rather than up. This is useful when you want to ensure the value doesn’t exceed a certain integer threshold.

await Member.$update({
    $where: { 
        age: { 
            $eq: 16 
        } 
    },
    $update: {
        $floor: {
          age: 1
        }
    }
});
Previous$sqrtNext$random

Last updated 2 months ago