Method DistinctAsync
DistinctAsync<TField>(FieldDefinition<TDocument, TField>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)
Gets the distinct values for a specified field.
public abstract 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
DistinctOptionsThe options.
cancellationToken
CancellationTokenThe 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.
public virtual Task<IAsyncCursor<TField>> DistinctAsync<TField>(IClientSessionHandle session, FieldDefinition<TDocument, TField> field, FilterDefinition<TDocument> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
field
FieldDefinition<TDocument, TField>The field.
filter
FilterDefinition<TDocument>The filter.
options
DistinctOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<TField>>
A Task whose result is a cursor.
Type Parameters
TField
The type of the result.