/// <summary> /// Sums the values of a selected field for a given filtered collection of documents. /// </summary> /// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <param name="filter">A LINQ expression filter.</param> /// <param name="selector">The field you want to sum.</param> /// <param name="partitionKey">The partition key of your document, if any.</param> public virtual int SumBy <TDocument>(Expression <Func <TDocument, bool> > filter, Expression <Func <TDocument, int> > selector, string partitionKey = null) where TDocument : IDocument <TKey> { return(MongoDbReader.SumBy <TDocument, TKey>(filter, selector, partitionKey)); }
/// <summary> /// Sums the values of a selected field for a given filtered collection of documents. /// </summary> /// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam> /// <param name="filter">A LINQ expression filter.</param> /// <param name="selector">The field you want to sum.</param> /// <param name="partitionKey">The partition key of your document, if any.</param> public virtual decimal SumBy <TDocument, TKey>(Expression <Func <TDocument, bool> > filter, Expression <Func <TDocument, decimal> > selector, string partitionKey = null) where TDocument : IDocument <TKey> where TKey : IEquatable <TKey> { return(MongoDbReader.SumBy <TDocument, TKey>(filter, selector, partitionKey)); }