ISSUE SUMMARY
In MongoDB versions 7.0.9 and 7.3.2, the behavior of bitwise query operators changed such that the bytes in BinData values were interpreted in reverse order. This can result in incorrect results for queries which use the bitwise operators either with BinData arguments or to match against BinData values.
The incorrect behavior was introduced in SERVER-88173. This ticket (SERVER-90288) reverts the change, restoring the correct behavior for the bitwise query operators.
ISSUE DESCRIPTION AND IMPACT
The bitwise query operators were implemented such that they interpreted BinData values in a little endian format (that is, the lowest addressable byte was interpreted as the least significant byte). Little endian was chosen for consistency with BSON’s little endian representation for numbers.
SERVER-88173 changed the bitwise query operators (in versions 7.0.9 and 7.3.2) to interpret BinData values as big endian, such that the highest addressable byte was interpreted as the least significant byte. This changes which documents the bitwise operators match and, as such, can change the results of queries which use the bitwise operators either with BinData arguments or to match against BinData values.
Bitwise operators using a numerical bitmask or specifying explicit bit positions matching against stored numbers are not affected by the change in versions 7.0.9 and 7.3.2.
This ticket reverts the changes from SERVER-88173 so that the bitwise operators again interpret BinData arguments using little endian format.
REMEDIATIONS AND WORKAROUNDS
This issue will be fixed in versions 7.0.11 and 7.3.3. Users who are experiencing issues with the bitwise operators in versions 7.0.9 or 7.3.2 can:
- Downgrade to 7.0.8
- Upgrade to versions 7.0.11 or 7.3.3 (or later)
Note that, at the time of writing, 7.0.11 and 7.3.3 have yet to be released.
Original Description:
This ticket reverts the changes introduced in SERVER-88173
- is related to
-
SERVER-88173 BinData bit comparisons give wrong results in many cases
- Closed