Class MapReduce

    • Constructor Detail

      • MapReduce

        public MapReduce​(org.bson.BsonDocument properties)
                  throws InvalidMetadataException
        Parameters:
        properties - the json properties object. It must include the following properties:
        • type
        • uri
        • map
        • reduce
        Optionally it can include the following property:
        • query
        Note that the dollar prefixed operators in the query must be underscore escaped, e.g. "_$exits"

        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 Detail

      • getMap

        public String getMap()
        Returns:
        the map
      • getReduce

        public String getReduce()
        Returns:
        the reduce
      • getQuery

        public org.bson.BsonValue getQuery()
        Returns:
        the query
      • getResolvedMap

        public String getResolvedMap​(org.bson.BsonDocument aVars)
        Parameters:
        aVars - RequestContext.getAggregationVars()
        Returns:
        the map function with bound aggregation variables
      • getResolvedReduce

        public String getResolvedReduce​(org.bson.BsonDocument aVars)
        Parameters:
        aVars - RequestContext.getAggregationVars()
        Returns:
        the reduce function with bound aggregation variables