Skip to main content

$ceil

The $ceil operator returns the smallest integer value that is greater than or equal to the input value.

Input

  • A single numeric value

Output

  • The ceiling of the input value (rounded up to the nearest integer)

Examples

Decimal Below .5

{
  "$ceil": [
    3.2
  ]
}
Result: 4

Decimal Above .5

{
  "$ceil": [
    7.8
  ]
}
Result: 8

Exact Integer

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

Negative Number

{
  "$ceil": [
    -3.2
  ]
}
Result: -3

Field Value

{
  "$ceil": [
    {
      "$input": "average_rating"
    }
  ]
}
Result: The ceiling of the average_rating field