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? -
Specifies the default collation for the collection.
Declaration
Swift
public var collation: BSONDocument? -
Specifies the
DataCodingStrategyto use for BSON encoding/decoding operations performed by this collection. It is the responsibility of the user to ensure that anyDatas already stored in this collection can be decoded using this strategy.Declaration
Swift
public var dataCodingStrategy: DataCodingStrategy? -
Specifies the
DateCodingStrategyto use for BSON encoding/decoding operations performed by this collection. It is the responsibility of the user to ensure that anyDates already stored in this collection can be decoded using this strategy.Declaration
Swift
public var dateCodingStrategy: DateCodingStrategy? -
Number of seconds after which old time series data should be deleted.
Declaration
Swift
public var expireAfterSeconds: Int? -
Specify a default configuration for indexes created on this collection.
Declaration
Swift
public var indexOptionDefaults: BSONDocument? -
Maximum number of documents allowed in the collection (if capped).
Declaration
Swift
public var max: Int? -
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: [BSONDocument]? -
Maximum size, in bytes, of this collection (if capped).
Declaration
Swift
public var size: Int? -
Specifies storage engine configuration for this collection.
Declaration
Swift
public var storageEngine: BSONDocument? -
The options used for creating a time series collection. This feature is only available on MongoDB 5.0+.
Declaration
Swift
public var timeseries: TimeseriesOptions? -
Specifies the
UUIDCodingStrategyto use for BSON encoding/decoding operations performed by this collection. It is the responsibility of the user to ensure that anyUUIDs already stored in this collection can be decoded using this strategy.Declaration
Swift
public var uuidCodingStrategy: UUIDCodingStrategy? -
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? -
Determines how strictly MongoDB applies the validation rules to existing documents during an update.
Declaration
Swift
public var validationLevel: String? -
What validator should be used for the collection.
Declaration
Swift
public var validator: BSONDocument? -
The name of the source collection or view from which to create the view.
Declaration
Swift
public var viewOn: String? -
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? -
init(capped:collation: dataCodingStrategy: dateCodingStrategy: expireAfterSeconds: indexOptionDefaults: max: pipeline: size: storageEngine: timeseries: uuidCodingStrategy: validationAction: validationLevel: validator: viewOn: writeConcern: ) Convenience initializer allowing any/all parameters to be omitted or optional.
Declaration
Swift
public init( capped: Bool? = nil, collation: BSONDocument? = nil, dataCodingStrategy: DataCodingStrategy? = nil, dateCodingStrategy: DateCodingStrategy? = nil, expireAfterSeconds: Int? = nil, indexOptionDefaults: BSONDocument? = nil, max: Int? = nil, pipeline: [BSONDocument]? = nil, size: Int? = nil, storageEngine: BSONDocument? = nil, timeseries: TimeseriesOptions? = nil, uuidCodingStrategy: UUIDCodingStrategy? = nil, validationAction: String? = nil, validationLevel: String? = nil, validator: BSONDocument? = nil, viewOn: String? = nil, writeConcern: WriteConcern? = nil )
View on GitHub
Install in Dash
CreateCollectionOptions Structure Reference