Method MinAsync
MinAsync<TSource>(IMongoQueryable<TSource>, CancellationToken)
Returns the minimum value in a generic IMongoQueryable<T>.
public static Task<TSource> MinAsync<TSource>(this IMongoQueryable<TSource> source, CancellationToken cancellationToken = default)
Parameters
source
IMongoQueryable<TSource>A sequence of values to determine the minimum of.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<TSource>
The minimum value in the sequence.
Type Parameters
TSource
The type of the elements of
source
.
MinAsync<TSource, TResult>(IMongoQueryable<TSource>, Expression<Func<TSource, TResult>>, CancellationToken)
Invokes a projection function on each element of a generic IMongoQueryable<T> and returns the minimum resulting value.
public static Task<TResult> MinAsync<TSource, TResult>(this IMongoQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, CancellationToken cancellationToken = default)
Parameters
source
IMongoQueryable<TSource>A sequence of values to determine the minimum of.
selector
Expression<Func<TSource, TResult>>A projection function to apply to each element.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<TResult>
The minimum value in the sequence.
Type Parameters
TSource
The type of the elements of
source
.TResult
The type of the value returned by the function represented by
selector
.