CreateCollectionOptions

public struct CreateCollectionOptions : Encodable, CodingStrategyProvider

Options to use when executing a createCollection command on a MongoDatabase.

  • Indicates whether this will be a capped collection

    Declaration

    Swift

    public let capped: Bool?
  • Whether or not this collection will automatically generate an index on _id

    Declaration

    Swift

    public let autoIndexId: Bool?
  • Maximum size, in bytes, of this collection (if capped)

    Declaration

    Swift

    public let size: Int64?
  • max

    Maximum number of documents allowed in the collection (if capped)

    Declaration

    Swift

    public let max: Int64?
  • Determine which storage engine to use

    Declaration

    Swift

    public let storageEngine: Document?
  • What validator should be used for the collection

    Declaration

    Swift

    public let validator: Document?
  • Determines how strictly MongoDB applies the validation rules to existing documents during an update

    Declaration

    Swift

    public let validationLevel: String?
  • Determines whether to error on invalid documents or just warn about the violations but allow invalid documents to be inserted

    Declaration

    Swift

    public let validationAction: String?
  • Allows users to specify a default configuration for indexes when creating a collection

    Declaration

    Swift

    public let indexOptionDefaults: Document?
  • The name of the source collection or view from which to create the view

    Declaration

    Swift

    public let viewOn: String?
  • Specifies the default collation for the collection

    Declaration

    Swift

    public let collation: Document?
  • A session to associate with this operation

    Declaration

    Swift

    public let session: ClientSession?
  • A write concern to use when executing this command. To set a read or write concern for the collection itself, retrieve the collection using MongoDatabase.collection.

    Declaration

    Swift

    public let writeConcern: WriteConcern?
  • Specifies the DateCodingStrategy to use for BSON encoding/decoding operations performed by this collection. It is the responsibility of the user to ensure that any Dates already stored in this collection can be decoded using this strategy.

    Declaration

    Swift

    public let dateCodingStrategy: DateCodingStrategy?
  • Specifies the UUIDCodingStrategy to use for BSON encoding/decoding operations performed by this collection. It is the responsibility of the user to ensure that any UUIDs already stored in this collection can be decoded using this strategy.

    Declaration

    Swift

    public let uuidCodingStrategy: UUIDCodingStrategy?
  • Specifies the DataCodingStrategy to use for BSON encoding/decoding operations performed by this collection. It is the responsibility of the user to ensure that any Datas already stored in this collection can be decoded using this strategy.

    Declaration

    Swift

    public let dataCodingStrategy: DataCodingStrategy?
  • Convenience initializer allowing any/all parameters to be omitted or optional

    Declaration

    Swift

    public init(autoIndexId: Bool? = nil,
                capped: Bool? = nil,
                collation: Document? = nil,
                indexOptionDefaults: Document? = nil,
                max: Int64? = nil,
                session: ClientSession? = nil,
                size: Int64? = nil,
                storageEngine: Document? = nil,
                validationAction: String? = nil,
                validationLevel: String? = nil,
                validator: Document? = nil,
                viewOn: String? = nil,
                writeConcern: WriteConcern? = nil,
                dateCodingStrategy: DateCodingStrategy? = nil,
                uuidCodingStrategy: UUIDCodingStrategy? = nil,
                dataCodingStrategy: DataCodingStrategy? = nil)