DataDecodingStrategy

public enum DataDecodingStrategy

Enum representing the various strategies for decoding Datas from BSON.

As per the BSON specification, the default strategy is to decode Datas from BSON binary types with the generic binary subtype.

See also

bsonspec.org
  • Decode Datas by deferring to their default decoding implementation.

    Note: The default decoding implementation attempts to decode the Data from a [UInt8], but because BSON does not support integer types other Int32 and Int64, it actually decodes from an [Int32] stored in BSON. This strategy paired with its corresponding encoding strategy results in an inefficient storage of the Data in BSON.

    Declaration

    Swift

    case deferredToData
  • Decode Datas stored as the BSONBinary type (default).

    Declaration

    Swift

    case binary
  • Decode Datas stored as base64 encoded strings.

    Declaration

    Swift

    case base64
  • Decode Datas using the provided closure.

    Declaration

    Swift

    case custom((_ decoder: Decoder) throws -> Data)