Class MapReduce
java.lang.Object
org.restheart.mongodb.handlers.aggregation.AbstractAggregationOperation
org.restheart.mongodb.handlers.aggregation.MapReduce
represents a map reduce.
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.restheart.mongodb.handlers.aggregation.AbstractAggregationOperation
AbstractAggregationOperation.TYPE -
Field Summary
FieldsFields inherited from class org.restheart.mongodb.handlers.aggregation.AbstractAggregationOperation
AGGREGATIONS_ELEMENT_NAME, TYPE_ELEMENT_NAME, URI_ELEMENT_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetMap()org.bson.BsonValuegetQuery()getResolvedMap(org.bson.BsonDocument aVars) org.bson.BsonDocumentgetResolvedQuery(org.bson.BsonDocument aVars) getResolvedReduce(org.bson.BsonDocument aVars) Methods inherited from class org.restheart.mongodb.handlers.aggregation.AbstractAggregationOperation
bindAggregationVariables, checkAggregationVariables, getFromJson, getType, getUri
-
Field Details
-
MAP_ELEMENT_NAME
- See Also:
-
REDUCE_ELEMENT_NAME
- See Also:
-
QUERY_ELEMENT_NAME
- See Also:
-
-
Constructor Details
-
MapReduce
- Parameters:
properties- the json properties object. It must include the following properties:typeurimapreduce
query
Example:
aggregations: [ { "type":"mapReduce", "uri":"test", "map":"function() { emit(this.name, this.age) }", "reduce":"function(key, values) { return Array.avg(values) }", "query": {"name":{"_$exists":true}} }]- Throws:
InvalidMetadataException
-
-
Method Details
-
getMap
- Returns:
- the map
-
getReduce
- Returns:
- the reduce
-
getQuery
public org.bson.BsonValue getQuery()- Returns:
- the query
-
getResolvedQuery
public org.bson.BsonDocument getResolvedQuery(org.bson.BsonDocument aVars) throws InvalidMetadataException, QueryVariableNotBoundException - Parameters:
aVars- RequestContext.getAggregationVars()- Returns:
- the query with unescaped operators and bound variables
- Throws:
InvalidMetadataExceptionQueryVariableNotBoundException
-
getResolvedMap
- Parameters:
aVars- RequestContext.getAggregationVars()- Returns:
- the map function with bound aggregation variables
-
getResolvedReduce
- Parameters:
aVars- RequestContext.getAggregationVars()- Returns:
- the reduce function with bound aggregation variables
-