Skip to main content

$lte

The $lte operator checks if the first value is less than or equal to the second value.

Input

  • An array containing exactly two values to compare

Output

  • true if the first value is less than or equal to the second value
  • false otherwise (including when either value is null)

Examples

Less Than

{
  "$lte": [
    5,
    10
  ]
}
Result: true

Equal Values

{
  "$lte": [
    5,
    5
  ]
}
Result: true

Greater Than (Returns False)

{
  "$lte": [
    7,
    3
  ]
}
Result: false

Field Value Comparison

{
  "$lte": [
    {
      "$input": "price"
    },
    100
  ]
}
Result: true if the price field is less than or equal to 100, otherwise false