Method DistinctMany
DistinctMany<TDocument, TItem>(IMongoCollection<TDocument>, Expression<Func<TDocument, IEnumerable<TItem>>>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)
Gets the distinct values for a specified array field.
public static IAsyncCursor<TItem> DistinctMany<TDocument, TItem>(this IMongoCollection<TDocument> collection, Expression<Func<TDocument, IEnumerable<TItem>>> field, FilterDefinition<TDocument> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection<TDocument>The collection.
field
Expression<Func<TDocument, IEnumerable<TItem>>>The field.
filter
FilterDefinition<TDocument>The filter.
options
DistinctOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocument
The type of the document.
TItem
The type of the array items.
DistinctMany<TDocument, TItem>(IMongoCollection<TDocument>, FieldDefinition<TDocument, IEnumerable<TItem>>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)
Gets the distinct values for a specified array field.
public static IAsyncCursor<TItem> DistinctMany<TDocument, TItem>(this IMongoCollection<TDocument> collection, FieldDefinition<TDocument, IEnumerable<TItem>> field, Expression<Func<TDocument, bool>> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection<TDocument>The collection.
field
FieldDefinition<TDocument, IEnumerable<TItem>>The field.
filter
Expression<Func<TDocument, bool>>The filter.
options
DistinctOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocument
The type of the document.
TItem
The type of the array items.
DistinctMany<TDocument, TItem>(IMongoCollection<TDocument>, Expression<Func<TDocument, IEnumerable<TItem>>>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)
Gets the distinct values for a specified array field.
public static IAsyncCursor<TItem> DistinctMany<TDocument, TItem>(this IMongoCollection<TDocument> collection, Expression<Func<TDocument, IEnumerable<TItem>>> field, Expression<Func<TDocument, bool>> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection<TDocument>The collection.
field
Expression<Func<TDocument, IEnumerable<TItem>>>The field.
filter
Expression<Func<TDocument, bool>>The filter.
options
DistinctOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocument
The type of the document.
TItem
The type of the array items.
DistinctMany<TDocument, TItem>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, IEnumerable<TItem>>>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)
Gets the distinct values for a specified array field.
public static IAsyncCursor<TItem> DistinctMany<TDocument, TItem>(this IMongoCollection<TDocument> collection, IClientSessionHandle session, Expression<Func<TDocument, IEnumerable<TItem>>> field, FilterDefinition<TDocument> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection<TDocument>The collection.
session
IClientSessionHandleThe session.
field
Expression<Func<TDocument, IEnumerable<TItem>>>The field.
filter
FilterDefinition<TDocument>The filter.
options
DistinctOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocument
The type of the document.
TItem
The type of the array items.
DistinctMany<TDocument, TItem>(IMongoCollection<TDocument>, IClientSessionHandle, FieldDefinition<TDocument, IEnumerable<TItem>>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)
Gets the distinct values for a specified array field.
public static IAsyncCursor<TItem> DistinctMany<TDocument, TItem>(this IMongoCollection<TDocument> collection, IClientSessionHandle session, FieldDefinition<TDocument, IEnumerable<TItem>> field, Expression<Func<TDocument, bool>> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection<TDocument>The collection.
session
IClientSessionHandleThe session.
field
FieldDefinition<TDocument, IEnumerable<TItem>>The field.
filter
Expression<Func<TDocument, bool>>The filter.
options
DistinctOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocument
The type of the document.
TItem
The type of the array items.
DistinctMany<TDocument, TItem>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, IEnumerable<TItem>>>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)
Gets the distinct values for a specified array field.
public static IAsyncCursor<TItem> DistinctMany<TDocument, TItem>(this IMongoCollection<TDocument> collection, IClientSessionHandle session, Expression<Func<TDocument, IEnumerable<TItem>>> field, Expression<Func<TDocument, bool>> filter, DistinctOptions options = null, CancellationToken cancellationToken = default)
Parameters
collection
IMongoCollection<TDocument>The collection.
session
IClientSessionHandleThe session.
field
Expression<Func<TDocument, IEnumerable<TItem>>>The field.
filter
Expression<Func<TDocument, bool>>The filter.
options
DistinctOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocument
The type of the document.
TItem
The type of the array items.