Uploaded image for project: 'Swift Driver'
  1. Swift Driver
  2. SWIFT-153

Preserve type fidelity for deprecated BSON types

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The BsonValue.encode() implementations for both DBPointer and Symbol throw a MongoError.bsonEncodeError stating that the types are deprecated and alternatives should be used instead. When decoding BSON into Swift, DBPointer and Symbol are converted to a DBRef document and String, respectively. That silent conversion can result in a loss of type fidelity.

      Meanwhile, Undefined BSON types (i.e. 0x06) is decoded as nil and will encode as such if roundtripped through the driver.

      It would be preferable if the driver decoded this deprecated types into their own struct so that they could be roundtripped as-is. The driver can also prevent users from manually creating these types outside of decoding existing BSON.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jmikola Jeremy Mikola
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: