CreateCollectionOptions

public struct CreateCollectionOptions : Codable, CodingStrategyProvider

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

  • Indicates whether this will be a capped collection.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    public var size: Int64?
  • max

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

    Declaration

    Swift

    public var max: Int64?
  • Specifies storage engine configuration for this collection.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    public var 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 var validationAction: String?
  • Specify a default configuration for indexes created on this collection.

    Declaration

    Swift

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

    Declaration

    Swift

    public var viewOn: String?
  • An array consisting of aggregation pipeline stages. When used with viewOn, will create the view by applying this pipeline to the source collection or view.

    Declaration

    Swift

    public var pipeline: [Document]?
  • Specifies the default collation for the collection.

    Declaration

    Swift

    public var collation: Document?
  • 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 var 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 var 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 var 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 var 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,
                pipeline: [Document]? = 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)