Skip to main content

$bitXor

The $bitXor operator performs a bitwise XOR (exclusive OR) operation on integer values.

Input

  • An array of integer values (at least 2 values required)

Output

  • The result of performing a bitwise XOR operation on all input values

Examples

Basic Bitwise XOR

{
  "$bitXor": [
    5,
    3
  ]
}
Result: 6 (binary: 101 XOR 011 = 110)

Multiple Values

{
  "$bitXor": [
    7,
    4,
    1
  ]
}
Result: 2 (binary: 111 XOR 100 XOR 001 = 010)

Field Value

{
  "$bitXor": [
    {
      "$input": "value1"
    },
    {
      "$input": "value2"
    }
  ]
}
Result: The bitwise XOR of value1 and value2 fields