/// <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="maxValueSelector">A property selector to order by descending.</param> /// <param name="partitionKey">An optional partitionKey.</param> /// <returns></returns> public TDocument GetByMax <TDocument>(Expression <Func <TDocument, bool> > filter, Expression <Func <TDocument, object> > maxValueSelector, string partitionKey = null) where TDocument : IDocument <TKey> { return(MongoDbReader.GetByMax <TDocument, TKey>(filter, maxValueSelector, partitionKey)); }