Table of Contents

Class ChangeStreamOperation<TResult>

Namespace
MongoDB.Driver.Core.Operations
Assembly
MongoDB.Driver.Core.dll

A change stream operation.

public class ChangeStreamOperation<TResult> : IChangeStreamOperation<TResult>, IReadOperation<IChangeStreamCursor<TResult>>

Type Parameters

TResult

The type of the result values.

Inheritance
ChangeStreamOperation<TResult>
Implements
Inherited Members
Extension Methods

Constructors

ChangeStreamOperation(CollectionNamespace, IEnumerable<BsonDocument>, IBsonSerializer<TResult>, MessageEncoderSettings)

Initializes a new instance of the ChangeStreamOperation<TResult> class.

public ChangeStreamOperation(CollectionNamespace collectionNamespace, IEnumerable<BsonDocument> pipeline, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings)

Parameters

collectionNamespace CollectionNamespace

The collection namespace.

pipeline IEnumerable<BsonDocument>

The pipeline.

resultSerializer IBsonSerializer<TResult>

The result value serializer.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

ChangeStreamOperation(DatabaseNamespace, IEnumerable<BsonDocument>, IBsonSerializer<TResult>, MessageEncoderSettings)

Initializes a new instance of the ChangeStreamOperation<TResult> class.

public ChangeStreamOperation(DatabaseNamespace databaseNamespace, IEnumerable<BsonDocument> pipeline, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings)

Parameters

databaseNamespace DatabaseNamespace

The database namespace.

pipeline IEnumerable<BsonDocument>

The pipeline.

resultSerializer IBsonSerializer<TResult>

The result value serializer.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

ChangeStreamOperation(IEnumerable<BsonDocument>, IBsonSerializer<TResult>, MessageEncoderSettings)

Initializes a new instance of the ChangeStreamOperation<TResult> class.

public ChangeStreamOperation(IEnumerable<BsonDocument> pipeline, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings)

Parameters

pipeline IEnumerable<BsonDocument>

The pipeline.

resultSerializer IBsonSerializer<TResult>

The result value serializer.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

Properties

BatchSize

Gets or sets the size of the batch.

public int? BatchSize { get; set; }

Property Value

int?

The size of the batch.

Collation

Gets or sets the collation.

public Collation Collation { get; set; }

Property Value

Collation

The collation.

CollectionNamespace

Gets the collection namespace.

public CollectionNamespace CollectionNamespace { get; }

Property Value

CollectionNamespace

The collection namespace.

Comment

Gets or sets the comment.

public BsonValue Comment { get; set; }

Property Value

BsonValue

DatabaseNamespace

Gets the database namespace.

public DatabaseNamespace DatabaseNamespace { get; }

Property Value

DatabaseNamespace

The database namespace.

FullDocument

Gets or sets the full document option.

public ChangeStreamFullDocumentOption FullDocument { get; set; }

Property Value

ChangeStreamFullDocumentOption

The full document option.

FullDocumentBeforeChange

Gets or sets the full document before change option.

public ChangeStreamFullDocumentBeforeChangeOption FullDocumentBeforeChange { get; set; }

Property Value

ChangeStreamFullDocumentBeforeChangeOption

The full document before change option.

MaxAwaitTime

Gets or sets the maximum await time.

public TimeSpan? MaxAwaitTime { get; set; }

Property Value

TimeSpan?

The maximum await time.

MessageEncoderSettings

Gets the message encoder settings.

public MessageEncoderSettings MessageEncoderSettings { get; }

Property Value

MessageEncoderSettings

The message encoder settings.

Pipeline

Gets the pipeline.

public IReadOnlyList<BsonDocument> Pipeline { get; }

Property Value

IReadOnlyList<BsonDocument>

The pipeline.

ReadConcern

Gets or sets the read concern.

public ReadConcern ReadConcern { get; set; }

Property Value

ReadConcern

The read concern.

ResultSerializer

Gets the result serializer.

public IBsonSerializer<TResult> ResultSerializer { get; }

Property Value

IBsonSerializer<TResult>

The result serializer.

ResumeAfter

Gets or sets the resume after value.

public BsonDocument ResumeAfter { get; set; }

Property Value

BsonDocument

The resume after value.

RetryRequested

Gets or sets a value indicating whether to retry.

public bool RetryRequested { get; set; }

Property Value

bool

Whether to retry.

ShowExpandedEvents

Gets or sets whether the change stream should show expanded events (MongoDB 6.0 and later).

public bool? ShowExpandedEvents { get; set; }

Property Value

bool?

The value.

StartAfter

Gets or sets the start after value.

public BsonDocument StartAfter { get; set; }

Property Value

BsonDocument

The start after value.

StartAtOperationTime

Gets or sets the start at operation time.

public BsonTimestamp StartAtOperationTime { get; set; }

Property Value

BsonTimestamp

The start at operation time.

Methods

Execute(IReadBinding, CancellationToken)

Executes the operation.

public IChangeStreamCursor<TResult> Execute(IReadBinding binding, CancellationToken cancellationToken)

Parameters

binding IReadBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

IChangeStreamCursor<TResult>

The result of the operation.

ExecuteAsync(IReadBinding, CancellationToken)

Executes the operation.

public Task<IChangeStreamCursor<TResult>> ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)

Parameters

binding IReadBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<TResult>>

A Task whose result is the result of the operation.

Resume(IReadBinding, CancellationToken)

Resumes the operation after a resume token.

public IAsyncCursor<RawBsonDocument> Resume(IReadBinding binding, CancellationToken cancellationToken)

Parameters

binding IReadBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<RawBsonDocument>

A cursor.

ResumeAsync(IReadBinding, CancellationToken)

Resumes the operation after a resume token.

public Task<IAsyncCursor<RawBsonDocument>> ResumeAsync(IReadBinding binding, CancellationToken cancellationToken)

Parameters

binding IReadBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<RawBsonDocument>>

A Task whose result is a cursor.