private BsonDocument GetGroupDocument(ActionsChartConfiguration chartConfiguration) { var groupClauseStrategy = new GroupClauseStrategy(); var groupBuilder = new GroupBuilder(); groupBuilder.BuildIdClause("'userId'", "'$UserId'"); groupClauseStrategy.Fill(groupBuilder, chartConfiguration.ResultChartInterval); groupBuilder.BuildResultClause("$sum", (chartConfiguration.ResultChartType == ResultChartType.Events ? "1" : "\"$Nectar\"")); return(groupBuilder.Document); }
private IAggregateFluent <BsonDocument> GetDefaultReportColumnQuery(string matchClauseName, int[] matchValues, string resultValue) { var matchBuilder = new MatchBuilder(); var groupBuilder = new GroupBuilder(); matchBuilder.BuildClause(matchClauseName, matchValues, MatchType.Integer); groupBuilder.BuildIdClause("'_id'", "'$UserId'"); groupBuilder.BuildResultClause("$sum", resultValue); return(GetCollection().Aggregate() .Match(matchBuilder.Document) .Group(groupBuilder.Document)); }