Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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));
        }