Table of Contents

Method DistinctAsync

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

DistinctAsync<TField>(FieldDefinition<TDocument, TField>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

Task<IAsyncCursor<TField>> DistinctAsync<TField>(FieldDefinition<TDocument, TField> field, FilterDefinition<TDocument> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)

Parameters

field FieldDefinition<TDocument, TField>

The field.

filter FilterDefinition<TDocument>

The filter.

options DistinctOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<TField>>

A Task whose result is a cursor.

Type Parameters

TField

The type of the result.

DistinctAsync<TField>(IClientSessionHandle, FieldDefinition<TDocument, TField>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

Task<IAsyncCursor<TField>> DistinctAsync<TField>(IClientSessionHandle session, FieldDefinition<TDocument, TField> field, FilterDefinition<TDocument> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

field FieldDefinition<TDocument, TField>

The field.

filter FilterDefinition<TDocument>

The filter.

options DistinctOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<TField>>

A Task whose result is a cursor.

Type Parameters

TField

The type of the result.