Class AggregationPipeline

java.lang.Object
org.restheart.mongodb.handlers.aggregation.AbstractAggregationOperation
org.restheart.mongodb.handlers.aggregation.AggregationPipeline

public class AggregationPipeline extends AbstractAggregationOperation
represents a map reduce.
Author:
Andrea Di Cesare <andrea@softinstigate.com>
  • Field Details

    • STAGES_ELEMENT_NAME

      public static final String STAGES_ELEMENT_NAME
      the stages property name
      See Also:
    • ALLOW_DISK_USER_ELEMENT_NAME

      public static final String ALLOW_DISK_USER_ELEMENT_NAME
      the allowDiskUse property name
      See Also:
  • Constructor Details

    • AggregationPipeline

      public AggregationPipeline(org.bson.BsonDocument properties) throws InvalidMetadataException
      Constructor from aggregation definition in collection metadata
      Parameters:
      properties - the json object defining the aggregation; it must include the array stages. Note: dollar prefixed operators in the stages must be underscore escaped, e.g. "_$exits". Example:
          {
              "type": "pipeline",
              "uri": "test_ap",
              "allowDiskUse": false,
              "stages": [ { "_$match": { "name": { "_$exists": true } } } ]
          }
           
      Throws:
      InvalidMetadataException
  • Method Details

    • getStages

      public org.bson.BsonArray getStages()
      Returns:
      the stages
    • removeOptionalNotBoundStages

      public org.bson.BsonArray removeOptionalNotBoundStages(org.bson.BsonDocument avars)
    • getResolvedStagesAsList

      public List<org.bson.BsonDocument> getResolvedStagesAsList(org.bson.BsonDocument avars) throws InvalidMetadataException, QueryVariableNotBoundException
      Parameters:
      avars - RequestContext.getAggregationVars()
      Returns:
      the stages, with unescaped operators and bound variables
      Throws:
      InvalidMetadataException
      QueryVariableNotBoundException
    • getAllowDiskUse

      public org.bson.BsonBoolean getAllowDiskUse()
      Returns:
      the allowDiskUse