Method Distinct
Distinct<TField>(FieldDefinition<TDocument, TField>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)
Gets the distinct values for a specified field.
public virtual IAsyncCursor<TField> Distinct<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
- IAsyncCursor<TField>
A cursor.
Type Parameters
TField
The type of the result.
Distinct<TField>(IClientSessionHandle, FieldDefinition<TDocument, TField>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)
Gets the distinct values for a specified field.
public virtual IAsyncCursor<TField> Distinct<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
- IAsyncCursor<TField>
A cursor.
Type Parameters
TField
The type of the result.