/** * Build a map reduce command * * @param map The map function * @param reduce The reduce function * @param outputType The outputType * @param collection The collection name, may be null if output type is INLINE * @param resultType The type to deserialise the result to * @param keyType The type of the keys that are being reduced on * @return The command */ public static <T, K> MapReduceCommand<T, K> build(String map, String reduce, OutputType outputType, String collection, Class<T> resultType, Class<K> keyType) { return new MapReduceCommand<T, K>(map, reduce, outputType, collection, resultType, keyType); }
/** * Performs a map reduce operation * * @param command The command to execute * @return The output * @throws MongoException If an error occurred */ public <S, L> MapReduceOutput<S, L> mapReduce(MapReduce.MapReduceCommand<S, L> command) throws MongoException { return new MapReduceOutput<S, L>(this, dbCollection.mapReduce(command.build(this)), command.getResultType(), command.getKeyType()); }
/** * Build a map reduce command * * @param map The map function * @param reduce The reduce function * @param outputType The outputType * @param collection The collection name, may be null if output type is INLINE * @param resultType The type to deserialise the result to * @param keyType The type of the keys that are being reduced on * @return The command */ public static <T, K> MapReduceCommand<T, K> build(String map, String reduce, OutputType outputType, String collection, Class<T> resultType, Class<K> keyType) { return new MapReduceCommand<T, K>(map, reduce, outputType, collection, resultType, keyType); }
/** * Performs a map reduce operation * * @param command The command to execute * @return The output * @throws MongoException If an error occurred */ public <S, L> MapReduceOutput<S, L> mapReduce(MapReduce.MapReduceCommand<S, L> command) throws MongoException { return new MapReduceOutput<S, L>(this, dbCollection.mapReduce(command.build(this)), command.getResultType(), command.getKeyType()); }