Table of Contents

Method DistinctManyAsync

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

DistinctManyAsync<TItem>(FieldDefinition<TDocument, IEnumerable<TItem>>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified array field.

public virtual Task<IAsyncCursor<TItem>> DistinctManyAsync<TItem>(FieldDefinition<TDocument, IEnumerable<TItem>> field, FilterDefinition<TDocument> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)

Parameters

field FieldDefinition<TDocument, IEnumerable<TItem>>

The field.

filter FilterDefinition<TDocument>

The filter.

options DistinctOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<TItem>>

A cursor.

Type Parameters

TItem

The type of the array items.

DistinctManyAsync<TItem>(IClientSessionHandle, FieldDefinition<TDocument, IEnumerable<TItem>>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified array field.

public virtual Task<IAsyncCursor<TItem>> DistinctManyAsync<TItem>(IClientSessionHandle session, FieldDefinition<TDocument, IEnumerable<TItem>> field, FilterDefinition<TDocument> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)

Parameters

session IClientSessionHandle

The session.

field FieldDefinition<TDocument, IEnumerable<TItem>>

The field.

filter FilterDefinition<TDocument>

The filter.

options DistinctOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IAsyncCursor<TItem>>

A cursor.

Type Parameters

TItem

The type of the array items.