ChangeStreamOptions
public struct ChangeStreamOptions : Codable
Options to use when creating a ChangeStream
.
-
The number of documents to return per batch. If omitted, the server will use its default batch size.
Declaration
Swift
public var batchSize: Int?
-
Specifies a collation.
Declaration
Swift
public var collation: BSONDocument?
-
Indicates how the
fullDocument
field of a change stream document should be filled out by the server. By default (indicated by a nil value for this option), thefullDocument
field in the change stream document will always be present in the case of ‘insert’ and ‘replace’ operations (containing the document being inserted) and will be nil for all other operations.Declaration
Swift
public var fullDocument: FullDocument?
-
The maximum amount of time in milliseconds for the server to wait on new documents to satisfy a change stream query. If omitted, the server will use its default timeout.
Declaration
Swift
public var maxAwaitTimeMS: Int?
-
A
ResumeToken
that manually specifies the logical starting point for the new change stream. The change stream will attempt to resume notifications starting after the operation associated with the provided token.Note
A change stream cannot be resumed after an invalidate event (e.g. a collection drop or rename).Declaration
Swift
public var resumeAfter: ResumeToken?
-
Similar to
resumeAfter
, this option takes aResumeToken
which will serve as the logical starting point for the new change stream. This option differs fromresumeAfter
in that it will allow a change stream to receive notifications even after an invalidate event (e.g. it will allow watching a collection that has been dropped and recreated).Declaration
Swift
public var startAfter: ResumeToken?
-
The change stream will only provide changes that occurred at or after the specified timestamp. Any command run against the server will return an operation time that can be used here.
Declaration
Swift
public var startAtOperationTime: BSONTimestamp?
-
Initializes a
ChangeStreamOptions
.Declaration
Swift
public init( batchSize: Int? = nil, collation: BSONDocument? = nil, fullDocument: FullDocument? = nil, maxAwaitTimeMS: Int? = nil, resumeAfter: ResumeToken? = nil, startAfter: ResumeToken? = nil, startAtOperationTime: BSONTimestamp? = nil )