Table of Contents

Class DistinctOperation<TValue>

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

Represents a distinct operation.

public class DistinctOperation<TValue> : IReadOperation<IAsyncCursor<TValue>>

Type Parameters

TValue

The type of the value.

Inheritance
DistinctOperation<TValue>
Implements
Inherited Members
Extension Methods

Constructors

DistinctOperation(CollectionNamespace, IBsonSerializer<TValue>, string, MessageEncoderSettings)

Initializes a new instance of the DistinctOperation<TValue> class.

public DistinctOperation(CollectionNamespace collectionNamespace, IBsonSerializer<TValue> valueSerializer, string fieldName, MessageEncoderSettings messageEncoderSettings)

Parameters

collectionNamespace CollectionNamespace

The collection namespace.

valueSerializer IBsonSerializer<TValue>

The value serializer.

fieldName string

The name of the field.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

Properties

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

The comment.

FieldName

Gets the name of the field.

public string FieldName { get; }

Property Value

string

The name of the field.

Filter

Gets or sets the filter.

public BsonDocument Filter { get; set; }

Property Value

BsonDocument

The filter.

MaxTime

Gets or sets the maximum time the server should spend on this operation.

public TimeSpan? MaxTime { get; set; }

Property Value

TimeSpan?

The maximum time the server should spend on this operation.

MessageEncoderSettings

Gets the message encoder settings.

public MessageEncoderSettings MessageEncoderSettings { get; }

Property Value

MessageEncoderSettings

The message encoder settings.

ReadConcern

Gets or sets the read concern.

public ReadConcern ReadConcern { get; set; }

Property Value

ReadConcern

The read concern.

RetryRequested

Gets or sets a value indicating whether to retry.

public bool RetryRequested { get; set; }

Property Value

bool

Whether to retry.

ValueSerializer

Gets the value serializer.

public IBsonSerializer<TValue> ValueSerializer { get; }

Property Value

IBsonSerializer<TValue>

The value serializer.

Methods

Execute(IReadBinding, CancellationToken)

Executes the operation.

public IAsyncCursor<TValue> Execute(IReadBinding binding, CancellationToken cancellationToken)

Parameters

binding IReadBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<TValue>

The result of the operation.

ExecuteAsync(IReadBinding, CancellationToken)

Executes the operation.

public Task<IAsyncCursor<TValue>> ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)

Parameters

binding IReadBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<TValue>>

A Task whose result is the result of the operation.