/// <summary> /// Groups a collection of documents given a grouping criteria, /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// </summary> /// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TGroupKey">The type of the grouping criteria.</typeparam> /// <typeparam name="TProjection">The type of the projected group.</typeparam> /// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupProjection">The projected group result.</param> /// <param name="partitionKey">The partition key of your document, if any.</param> public virtual List <TProjection> GroupBy <TDocument, TGroupKey, TProjection>( Expression <Func <TDocument, TGroupKey> > groupingCriteria, Expression <Func <IGrouping <TGroupKey, TDocument>, TProjection> > groupProjection, string partitionKey = null) where TDocument : IDocument <TKey> where TProjection : class, new() { return(MongoDbReader.GroupBy <TDocument, TGroupKey, TProjection, TKey>(groupingCriteria, groupProjection, partitionKey)); }