Module spring.data.mongodb
Interface ExecutableMapReduceOperation
- All Known Subinterfaces:
FluentMongoOperations,MongoOperations
- All Known Implementing Classes:
MongoTemplate
public interface ExecutableMapReduceOperation
ExecutableMapReduceOperation allows creation and execution of MongoDB mapReduce operations in a fluent API
style. The starting domainType is used for mapping an optional Query provided via matching
into the MongoDB specific representation. By default, the originating domainType is also used for mapping
back the results from the Document. However, it is possible to define an different
returnType via as to mapping the result.The collection to operate on is by default derived from the initial domainType and can be defined there via
Document. Using inCollection allows to override the
collection name for the execution.
mapReduce(Human.class)
.map("function() { emit(this.id, this.firstname) }")
.reduce("function(id, name) { return sum(id, name); }")
.inCollection("star-wars")
.as(Jedi.class)
.matching(query(where("lastname").is("skywalker")))
.all();
- Since:
- 2.1
- Author:
- Christoph Strobl, Mark Paluch
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceExecutableMapReduceOperation.ExecutableMapReduceprovides methods for constructing mapReduce operations in a fluent way.static interfaceCollection override (Optional).static interfaceProvide the Javascriptfunction()used to map matching documents.static interfaceDeprecated.static interfaceResult type override (Optional).static interfaceInput document filter query (Optional).static interfaceProvide the Javascriptfunction()used to reduce matching documents.static interfaceTrigger mapReduce execution by calling one of the terminating methods. -
Method Summary
Modifier and TypeMethodDescriptionStart creating a mapReduce operation for the given domainType.
-
Method Details
-
mapReduce
Start creating a mapReduce operation for the given domainType.- Parameters:
domainType- must not be null.- Returns:
- new instance of
ExecutableFindOperation.ExecutableFind. - Throws:
IllegalArgumentException- if domainType is null.
-
org.springframework.data.mongodb.core.aggregation.