Пример #1
0
 /// <summary>
 /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
 /// </summary>
 /// <typeparam name="TDocument">The document type.</typeparam>
 /// <typeparam name="TKey">The type of the primary key.</typeparam>
 /// <param name="filter">A LINQ expression filter.</param>
 /// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
 /// <param name="partitionKey">An optional partitionKey.</param>
 /// <param name="cancellationToken">An optional cancellation Token.</param>
 public async virtual Task <TDocument> GetByMinAsync <TDocument, TKey>(Expression <Func <TDocument, bool> > filter,
                                                                       Expression <Func <TDocument, object> > minValueSelector,
                                                                       string partitionKey = null,
                                                                       CancellationToken cancellationToken = default)
     where TDocument : IDocument <TKey>
     where TKey : IEquatable <TKey>
 {
     return(await MongoDbReader.GetByMinAsync <TDocument, TKey>(filter, minValueSelector, partitionKey, cancellationToken));
 }
 /// <summary>
 /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
 /// </summary>
 /// <typeparam name="TDocument">The document type.</typeparam>
 /// <param name="filter">A LINQ expression filter.</param>
 /// <param name="minValueSelector">A property selector to order by ascending.</param>
 /// <param name="partitionKey">An optional partitionKey.</param>
 public async Task <TDocument> GetByMinAsync <TDocument>(Expression <Func <TDocument, bool> > filter, Expression <Func <TDocument, object> > minValueSelector, string partitionKey = null)
     where TDocument : IDocument <TKey>
 {
     return(await MongoDbReader.GetByMinAsync <TDocument, TKey>(filter, minValueSelector, partitionKey));
 }