ChangeStreamSession

public class ChangeStreamSession<DocumentT> where DocumentT : Decodable, DocumentT : Encodable

A MongoDB Change Stream session. This can be used to get or change the delegate that reacts to change events on this stream. It can also be used to close open streams.

  • The delegate for this ChangeStreamSession. This is the class that will react to incoming events. A delegate is set at the time the watch function is called, but a new delegate may also be set here. This delegate type must conform to ChangeStreamDelegate

    Warning

    warning the delegate is held by the change stream as a weak reference. If the delegate becomes deallocated, the stream will automatically close the next time an event is received. If you are setting a new delegate, make sure you do so before the previous delegate is deallocated.

    Declaration

    Swift

    public var delegate: ChangeStreamType<DocumentT>? { get set }
  • Closes the stream so that no more events will be received.

    Declaration

    Swift

    public func close()