13.07.2015 Views

Spring Data MongoDB - Spring Web Services - Parent - SpringSource

Spring Data MongoDB - Spring Web Services - Parent - SpringSource

Spring Data MongoDB - Spring Web Services - Parent - SpringSource

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

please define productname in your docbook file!• In the forth step we use the group operation to define a group for each "tags"-value for which weaggregate the occurence count via the count aggregation operator and collect the result in a newfield called "n".• As a fifth step we select the field "n" and create an alias for the id-field generated from the previousgroup operation (hence the call to previousOperation()) with the name "tag".• As the sixth step we sort the resulting list of tags by their occurence count in descending order viathe sort operation.• Finally we call the aggregate Method on the MongoTemplate in order to let <strong>MongoDB</strong> perform theacutal aggregation operation with the created Aggregation as an argument.Note that the input collection is explicitly specified as the "tags" parameter to the aggregate Method.If the name of the input collection is not specified explicitly, it is derived from the input-class passed asfirst parameter to the newAggreation Method.1.4.0.BUILD-SNAPSHOT<strong>Spring</strong> <strong>Data</strong> <strong>MongoDB</strong> -Reference Documentation 57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!