UUIDCodingStrategy

public enum UUIDCodingStrategy : RawRepresentable

Enum representing the various encoding/decoding strategy pairs for UUIDs. Set these on a MongoClient, MongoDatabase, or MongoCollection so that the strategies will be applied when converting UUIDs between their BSON representations and their representations in (non Document) Codable types.

As per the BSON specification, the default strategy is to encode UUIDs as BSON binary types with the UUID subtype.

See also

bsonspec.org
  • Declaration

    Swift

    public typealias RawValue = (encoding: BSONEncoder.UUIDEncodingStrategy, decoding: BSONDecoder.UUIDDecodingStrategy)
  • Encode/decode the UUID by deferring to its default encoding/decoding implementations.

    Declaration

    Swift

    case deferredToUUID
  • Encode/decode the UUID to/from a BSON binary type (default).

    Declaration

    Swift

    case binary
  • Declaration

    Swift

    public init?(rawValue: RawValue)
  • Declaration

    Swift

    public var rawValue: RawValue { get }