code: public final <R> Iterable<R> mapReduce(String name, DBObject query, DBObject sort, Map<String, Object> scope, final MapReduceResultHandler<R> conv) {
          String map = this.getMRFunction(name, "map");
          String reduce = this.getMRFunction(name, "reduce");
  
          MapReduceCommand mrc = new MapReduceCommand(this.collection.getDBCollection(), map, reduce, null, MapReduceCommand.OutputType.INLINE, query);
          String finalizeFunction = this.getMRFunction(name, "finalize");
          if(finalizeFunction != null) {
              mrc.setFinalize(finalizeFunction);
          }
          if(sort != null) {
              mrc.setSort(sort);
          }
          if(scope != null) {
              mrc.setScope(scope);
          }
          MapReduceOutput mr = this.collection.getDBCollection().mapReduce(mrc);
          return new ConverterIterable<R>(mr.results().iterator(), conv);
      }
docs: runs a map-reduce-job on the collection. The functions are read from the classpath in the folder mongodb. The systems reads them from
  files called &lt;name&gt;.map.js, &lt;name&gt;.reduce.js and optionally &lt;name&gt;.finalize.js. After this the result is converted
  using the given {@link MapReduceResultHandler}
  
  @param <R>   the type of the result class
  @param name  the name of the map-reduce functions
  @param query the query to filter the elements used for the map-reduce
  @param sort  sort query to sort elements before running map-reduce
  @param scope the global scope for the JavaScript run
  @param conv  the converter to convert the result
  @return an {@link Iterable} with the result entries
  @throws RuntimeException if resources cannot be read