ChangeStreamEvent
public struct ChangeStreamEvent<T> : Codable where T : Decodable, T : Encodable
The response document type from a ChangeStream.
-
Describes the type of operation for this change.
Declaration
Swift
public let operationType: OperationType -
An opaque token for use when resuming an interrupted change stream.
Declaration
Swift
public let _id: ResumeToken -
A document containing the database and collection names in which this change happened.
Declaration
Swift
public let ns: MongoNamespace -
Only present for options of type
insert,update,replaceanddelete. For unsharded collections this contains a single field, _id, with the value of the _id of the document updated. For sharded collections, this will contain all the components of the shard key in order, followed by the _id if the _id isn’t part of the shard key.Declaration
Swift
public let documentKey: BSONDocument? -
An
UpdateDescriptioncontaining updated and removed fields in this operation. Only present for operations of typeupdate.Declaration
Swift
public let updateDescription: UpdateDescription? -
Always present for operations of type
insertandreplace. Also present for operations of typeupdateif the user has specified.updateLookupfor thefullDocumentoption in theChangeStreamOptionsused to create the change stream that emitted this document.For operations of type
insert’ andreplace’, this key will contain the document being inserted, or the new version of the document that is replacing the existing document, respectively.For operations of type `update’, this key will contain a copy of the full version of the document from some point after the update occurred. If the document was deleted since the updated happened, it will be nil.
Declaration
Swift
public let fullDocument: T? -
Declaration
Swift
public init(from decoder: Decoder) throws
View on GitHub
Install in Dash
ChangeStreamEvent Structure Reference