Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-5848

Implicit Conversion of Binary Data While Using Binary(..., 3)

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.32.3
    • Affects Version/s: None
    • Component/s: CRUD
    • None
    • 2
    • Iteration Dolphin, Iteration Eel
    • Not Needed

      Problem Statement/Rationale

      In both Data Explorer and Compass, inserting Binary('mkaTHwEZhaBQj+u1a3D3gA==', 3) using the aggregation pipeline's $addFields stage displays Binary('bWthVEh3RVpoYUJRait1MWEzRDNnQT09', 3). Using $out to persist the value to the collection inserts the latter as well. This seems wrong, because the base64 encoded data that was specified to be inserted is a valid UUID in the JAVA_LEGACY representation, but the inserted binary data is not. It is 24 bytes long instead of 16 bytes, but still has the subtype set to 3, so when the driver tries to decode it, there's an exception thrown (I have tried this with the Java driver, but presumably the behavior for other drivers is the same).{}

      Steps to Reproduce

      Try to insert the Binary(..., 3) data mentioned above (or any other base64 encoded subtype 3 value that's a valid UUID) and check the data in the collection post insert.

      Expected Results

      That there be no implicit conversion from base64 to some other representation in the insert process.

      Actual Results

      That there is some conversion going on, leading to the loss of data.

      Additional Notes

      Data Explorer is using compass libraries, so this is being observed there as well. 

        1. image (1).png
          87 kB
          Anna Henningsen

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            ramasai.tadepalli@mongodb.com Ramasai Tadepalli
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: