Skip to main content

$nor

The $nor operator evaluates multiple expressions and returns true only if all of them are falsy, otherwise it returns false. It’s the negation of the $or operator.

Input

  • An array of expressions to evaluate
  • Each expression is evaluated in order from left to right

Output

  • true if all expressions evaluate to falsy values
  • false if any expression evaluates to a truthy value

Examples

All Falsy Values

{
  "$nor": [
    false,
    false
  ]
}
Result: true

With Truthy Value

{
  "$nor": [
    false,
    true,
    false
  ]
}
Result: false

Multiple Expressions

[
  {
    "$nor": [
      {
        "$lt": [
          {
            "$input": "score"
          },
          10
        ]
      },
      {
        "$gt": [
          {
            "$input": "score"
          },
          90
        ]
      }
    ]
  }
]
Result: true if the score is NOT less than 10 AND NOT greater than 90 (i.e., score is between 10 and 90 inclusive), otherwise false