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
collectionIMongoCollection<TDocument>The collection.
fieldExpression<Func<TDocument, IEnumerable<TItem>>>The field.
filterFilterDefinition<TDocument>The filter.
optionsDistinctOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocumentThe type of the document.
TItemThe 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
collectionIMongoCollection<TDocument>The collection.
fieldFieldDefinition<TDocument, IEnumerable<TItem>>The field.
filterExpression<Func<TDocument, bool>>The filter.
optionsDistinctOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocumentThe type of the document.
TItemThe 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
collectionIMongoCollection<TDocument>The collection.
fieldExpression<Func<TDocument, IEnumerable<TItem>>>The field.
filterExpression<Func<TDocument, bool>>The filter.
optionsDistinctOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocumentThe type of the document.
TItemThe 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
collectionIMongoCollection<TDocument>The collection.
sessionIClientSessionHandleThe session.
fieldExpression<Func<TDocument, IEnumerable<TItem>>>The field.
filterFilterDefinition<TDocument>The filter.
optionsDistinctOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocumentThe type of the document.
TItemThe 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
collectionIMongoCollection<TDocument>The collection.
sessionIClientSessionHandleThe session.
fieldFieldDefinition<TDocument, IEnumerable<TItem>>The field.
filterExpression<Func<TDocument, bool>>The filter.
optionsDistinctOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocumentThe type of the document.
TItemThe 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
collectionIMongoCollection<TDocument>The collection.
sessionIClientSessionHandleThe session.
fieldExpression<Func<TDocument, IEnumerable<TItem>>>The field.
filterExpression<Func<TDocument, bool>>The filter.
optionsDistinctOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TItem>
The distinct values for the specified field.
Type Parameters
TDocumentThe type of the document.
TItemThe type of the array items.