We've decided to implement a few bit-test query operators:
$bitsAllSet - matches if the input bit positions are all 1
$bitsAllClear - matches if the input bit positions are all 0
$bitsAnySet - matches if any of the bit positions are 1
$bitsAnyClear - matches if any of the bit positions are 0
These operators can take an array of bit positions, a 64-bit number bitmask, or a BinData bitmask. For the number and BinData bitmasks, the bit positions to check are the positions of 1's in their binary representation.
The operators will only match against int32, int64, doubles, and binary data. Other types will not match.
Note that bit position 0 means the least significant bit.
An example using the array of bit positions syntax:
An example using the bitmask syntax: