Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-90288

Bitwise query operators should interpret lowest addressable byte in BinData as least significant byte

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 7.3.3, 8.0.0-rc5, 7.0.11
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0, v6.0, v5.0
    • QE 2024-05-13

      Issue Status as of May 15, 2024

      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

            Assignee:
            kristina.znam@mongodb.com Kristina Znam
            Reporter:
            mihai.andrei@mongodb.com Mihai Andrei
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: