Search code examples
mongodbjasper-reportsmapreduceireportjasperserver

MapReduce and iReport / Jasperserver (MongoDB)?


Does iReport support MapReduce ? (with MongoDB) simple query I would like to know if I can put a Map Reduce query in this windows, or if not on the report on jasperserver (When You upload you .jrxml you have a "Query" tab)

Thanks


Solution

  • Yes, it does. For example:

    {
      collectionName : 'dataByZipCode',
      sort : {
        'value.population' : -1,
      },
      mapReduce : {
        map : 'function () {
                   emit (this.state, {population : this.pop});
                 }',
        reduce : 'function (key, values) {
                      var total = 0;
                      for( var index = 0; index < values.length; index ++) {
                        total += values[index].population;
                      }
                      return {population : total}
                   }',
        out : 'totalPopulation'
      }
    }
    

    See the Jaspersoft MongoDB Connector Query Reference