Click or drag to resize

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

Gets the distinct values for a specified field.

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.6.0+Branch.origin/v2.6.x.Sha.593796a7b35dc59243383bcc684de296a5468f2e
Syntax
Task<IAsyncCursor<TField>> DistinctAsync<TField>(
	IClientSessionHandle session,
	FieldDefinition<TDocument, TField> field,
	FilterDefinition<TDocument> filter,
	DistinctOptions options = null,
	CancellationToken cancellationToken = null
)

Parameters

session
Type: MongoDB.Driver.IClientSessionHandle
The session.
field
Type: MongoDB.Driver.FieldDefinition<TDocument, TField>
The field.
filter
Type: MongoDB.Driver.FilterDefinition<TDocument>
The filter.
options (Optional)
Type: MongoDB.Driver.DistinctOptions
The options.
cancellationToken (Optional)
Type: System.Threading.CancellationToken
The cancellation token.

Type Parameters

TField
The type of the result.

Return Value

Type: Task<IAsyncCursor<TField>>
A Task whose result is a cursor.
See Also