P. 1
Spring Data Mongo Reference

Spring Data Mongo Reference

|Views: 2,033|Likes:
Published by somefreeloader

More info:

Published by: somefreeloader on Aug 18, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





MongoDB support

Spring Data Document ()


As an alternative to using Map-Reduce to perform data aggregation, you can use the group operation which
feels similar to using SQL's group by query style, so it may feel more approachable vs. using Map-Reduce.
Using the group operations does have some limitations, for example it is not supported in a shareded
environment and it returns the full result set in a single BSON object, so the result should be small, less than
10,000 keys.

Spring provides integration with MongoDB's group operation by providing methods on MongoOperations to
simplify the creation and execution of group operations. It can convert the results of the group operation to a
POJO and also integrates with Spring's Resource abstraction abstraction. This will let you place your JavaScript
files on the file system, classpath, http server or any other Spring Resource implementation and then reference
the JavaScript resources via an easy URI style syntax, e.g. 'classpath:reduce.js;. Externalizing JavaScript code
in files if often preferable to embedding them as Java strings in your code. Note that you can still pass
JavaScript code as Java strings if you prefer.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->