Skip to main content

$floor

The $floor operator returns the largest integer value that is less than or equal to the input value.

Input

  • A single numeric value

Output

  • The floor of the input value (rounded down to the nearest integer)

Examples

Decimal Below .5

{
  "$floor": [
    3.2
  ]
}
Result: 3

Decimal Above .5

{
  "$floor": [
    7.8
  ]
}
Result: 7

Exact Integer

{
  "$floor": [
    5
  ]
}
Result: 5

Negative Number

{
  "$floor": [
    -3.2
  ]
}
Result: -4

Field Value

{
  "$floor": [
    {
      "$input": "average_score"
    }
  ]
}
Result: The floor of the average_score field