-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for map-reduce operations in MongoTemplate [DATAMONGO-7] #945
Comments
Matthias Scudlik commented group by (like sql) integration with min/max/sum etc. in the Criteria API would be very useful |
Mark Pollack commented looks like 1.9 will have this - http://jira.mongodb.org/browse/SERVER-447 |
Matthias Scudlik commented Will this be added to the Criteria API, once 1.9 is out? |
Mark Pollack commented I think we will add features into the API to track the latest releases, these would then fail on an older server. Documenting this seems enough for now I think, we could add some server number checks as well. FWIW, the aggregation framework was move to 2.1, due date is now in Oct 2011 |
Matthias Scudlik commented I think you're right, but only with the new aggregation framework. All of these features can be done with map reduce as well i think. So the question is whether you can reverse engineer parts of it with map reduce |
Mark Pollack commented The API i'm thinking of implementing is looking like like what is in the C# driver. <T> MapReduceResult<T> mapReduce(String map, String reduce, Class<T> entityClass ) <T> MapReduceResult<T> mapReduce(String map, String reduce, MapReduceOptions options, Class<T> entityClass ) <T> MapReduceResult<T> mapReduce(Query query, String map, String reduce, Class<T> entityClass) <T> MapReduceResult<T> mapReduce(Query query, String map, String reduce, MapReduceOptions options, Class<T> entityClass) where you can create MapReduceOptions in a fluent API style like this public static MapReduceOptions options() { return new MapReduceOptions() } // possible pass in some common options in a ctor arg public static MapReduceOutput replace(String collectionName) { options().output(MapReduceOutput.replace(collectionName)) //default is replace options().finalize(finalize) etc... Strings will be attempted to be converted to a Spring resource URI so they can be picked up via the classpath or such this way map and reduce .js files can live separately. Using an extended criteria API just for map reduce, e.g. min-max might be possible in that one could generate the .js files on the fly for simple cases. I'd need to play with it a bit more as the more I dig into it the more delicate it seems to provide a general solution. What do you think? |
Matthias Scudlik commented I think this is a good solution. One can provide .js files for own UseCases but you also support the common functions like min and max. Note: |
Mark Pollack opened DATAMONGO-7 and commented
The use of MapReduce via the driver is cumbersome, provide a layer that exposes map reduce operations with type-safe helper objects.
Investigate: http://cookbook.mongodb.org/ lists a few common cases where one would use map-reduce, typically to sort/count document array elements. See how this might be better packaged up so as to avoid Java users from having to write JavaScript/MapReduce for common tasks
Issue Links:
("Cloned from")
1 votes, 1 watchers
The text was updated successfully, but these errors were encountered: