Skip to main content

$bitNot

The $bitNot operator performs a bitwise NOT (complement) operation on an integer value.

Input

  • A single integer value

Output

  • The result of performing a bitwise NOT operation on the input value

Examples

Basic Bitwise NOT

{
  "$bitNot": [
    5
  ]
}
Result: -6 (binary: …11111010, two’s complement of 5)

Field Value

{
  "$bitNot": [
    {
      "$input": "value"
    }
  ]
}
Result: The bitwise NOT of the value field