Class AggregationPipelineImpl

    • Constructor Summary

      Constructors 
      Constructor Description
      AggregationPipelineImpl​(Datastore datastore, MongoCollection collection, Class source)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an AggregationPipeline
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      <U> Iterator<U> aggregate​(Class<U> target)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Executes the pipeline and aggregates the output in to the type mapped by the target type using the default options as defined in AggregationOptions.
      <U> Iterator<U> aggregate​(Class<U> target, AggregationOptions options)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Executes the pipeline and aggregates the output in to the type mapped by the target type.
      <U> Iterator<U> aggregate​(Class<U> target, AggregationOptions options, ReadPreference readPreference)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Executes the pipeline and aggregates the output in to the type mapped by the target type.
      <U> Iterator<U> aggregate​(String collectionName, Class<U> target, AggregationOptions options, ReadPreference readPreference)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Executes the pipeline and aggregates the output in to the type mapped by the target type.
      AggregationPipeline bucket​(String field, List<?> boundaries)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.
      AggregationPipeline bucket​(String field, List<?> boundaries, BucketOptions options)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.
      AggregationPipeline bucketAuto​(String field, int bucketCount)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression.
      AggregationPipeline bucketAuto​(String field, int bucketCount, BucketAutoOptions options)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression.
      AggregationPipeline geoNear​(GeoNear geoNear)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns an ordered stream of documents based on the proximity to a geospatial point.
      AggregationPipeline group​(Group... groupings)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group .
      AggregationPipeline group​(String id, Group... groupings)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group.
      AggregationPipeline group​(List<Group> id, Group... groupings)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      AggregationPipeline limit​(int count)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Passes the first n documents unmodified to the pipeline where n is the specified limit.
      AggregationPipeline lookup​(String from, String localField, String foreignField, String as)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing.
      AggregationPipeline match​(Query query)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage.
      <U> Iterator<U> out​(Class<U> target)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Places the output of the aggregation in the collection mapped by the target type using the default options as defined in AggregationOptions.
      <U> Iterator<U> out​(Class<U> target, AggregationOptions options)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Places the output of the aggregation in the collection mapped by the target type.
      <U> Iterator<U> out​(String collectionName, Class<U> target)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Places the output of the aggregation in the collection mapped by the target type using the default options as defined in AggregationOptions.
      <U> Iterator<U> out​(String collectionName, Class<U> target, AggregationOptions options)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Places the output of the aggregation in the collection mapped by the target type.
      AggregationPipeline project​(Projection... projections)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Reshapes each document in the stream, such as by adding new fields or removing existing fields.
      AggregationPipeline sample​(int sampleSize)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Randomly selects the specified number of documents from the previous pipeline stage.
      AggregationPipeline skip​(int count)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline.
      AggregationPipeline sort​(Sort... sorts)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Reorders the document stream by a specified sort key.
      AggregationPipeline sortByCount​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group.
      String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      AggregationPipeline unwind​(String field)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Deconstructs an array field from the input documents to output a document for each element.
      AggregationPipeline unwind​(String field, UnwindOptions options)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Deconstructs an array field from the input documents to output a document for each element.
    • Constructor Detail

      • AggregationPipelineImpl

        public AggregationPipelineImpl​(Datastore datastore,
                                       MongoCollection collection,
                                       Class source)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates an AggregationPipeline
        Parameters:
        datastore - the datastore to use
        collection - the database collection on which to operate
        source - the source type to aggregate
    • Method Detail

      • aggregate

        public <U> Iterator<U> aggregate​(Class<U> target)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Executes the pipeline and aggregates the output in to the type mapped by the target type using the default options as defined in AggregationOptions. Note: This return type will change to MongoCursor in 2.0 to allow for finer-grained control of iteration and resource management.
        Specified by:
        aggregate in interface AggregationPipeline
        Type Parameters:
        U - type of the results
        Parameters:
        target - The class to use when iterating over the results
        Returns:
        an iterator of the computed results
      • aggregate

        public <U> Iterator<U> aggregate​(Class<U> target,
                                         AggregationOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Executes the pipeline and aggregates the output in to the type mapped by the target type. Note: This return type will change to MongoCursor in 2.0 to allow for finer-grained control of iteration and resource management.
        Specified by:
        aggregate in interface AggregationPipeline
        Type Parameters:
        U - type of the results
        Parameters:
        target - The class to use when iterating over the results
        options - The options to apply to this aggregation
        Returns:
        an iterator of the computed results
      • aggregate

        public <U> Iterator<U> aggregate​(Class<U> target,
                                         AggregationOptions options,
                                         ReadPreference readPreference)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Executes the pipeline and aggregates the output in to the type mapped by the target type. Note: This return type will change to MongoCursor in 2.0 to allow for finer-grained control of iteration and resource management.
        Specified by:
        aggregate in interface AggregationPipeline
        Type Parameters:
        U - type of the results
        Parameters:
        target - The class to use when iterating over the results
        options - The options to apply to this aggregation
        readPreference - The read preference to apply to this pipeline
        Returns:
        an iterator of the computed results
      • aggregate

        public <U> Iterator<U> aggregate​(String collectionName,
                                         Class<U> target,
                                         AggregationOptions options,
                                         ReadPreference readPreference)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Executes the pipeline and aggregates the output in to the type mapped by the target type. Note: This return type will change to MongoCursor in 2.0 to allow for finer-grained control of iteration and resource management.
        Specified by:
        aggregate in interface AggregationPipeline
        Type Parameters:
        U - type of the results
        Parameters:
        collectionName - The collection in which to store the results of the aggregation overriding the mapped value in target
        target - The class to use when iterating over the results
        options - The options to apply to this aggregation
        readPreference - The read preference to apply to this pipeline
        Returns:
        an iterator of the computed results
      • bucket

        public AggregationPipeline bucket​(String field,
                                          List<?> boundaries)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.

        Each bucket is represented as a document in the output. The document for each bucket contains an _id field, whose value specifies the inclusive lower bound of the bucket and a count field that contains the number of documents in the bucket. The count field is included by default when the output is not specified.

        Specified by:
        bucket in interface AggregationPipeline
        Parameters:
        field - the field that used as groupby for bucketing
        boundaries - An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries.
        Returns:
        this
      • bucket

        public AggregationPipeline bucket​(String field,
                                          List<?> boundaries,
                                          BucketOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries.

        Each bucket is represented as a document in the output. The document for each bucket contains an _id field, whose value specifies the inclusive lower bound of the bucket and a count field that contains the number of documents in the bucket. The count field is included by default when the output is not specified.

        Specified by:
        bucket in interface AggregationPipeline
        Parameters:
        field - the field that used as groupby for bucketing
        boundaries - An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries.
        options - options that include defaultField for values that not match in any boundaries and also allow to specify output by using accumulator Accumulator
        Returns:
        this
      • bucketAuto

        public AggregationPipeline bucketAuto​(String field,
                                              int bucketCount)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression. Bucket boundaries are automatically determined in an attempt to evenly distribute the documents into the specified number of buckets.

        Each bucket is represented as a document in the output. The document for each bucket contains an _id field, whose value specifies the inclusive lower bound and the exclusive upper bound for the bucket, and a count field that contains the number of documents in the bucket. The count field is included by default when the output is not specified.

        Specified by:
        bucketAuto in interface AggregationPipeline
        Parameters:
        field - the field that used as groupby for auto bucketing
        bucketCount - the number of buckets into which input documents are grouped
        Returns:
        this
      • bucketAuto

        public AggregationPipeline bucketAuto​(String field,
                                              int bucketCount,
                                              BucketAutoOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression. Bucket boundaries are automatically determined in an attempt to evenly distribute the documents into the specified number of buckets.

        Each bucket is represented as a document in the output. The document for each bucket contains an _id field, whose value specifies the inclusive lower bound and the exclusive upper bound for the bucket, and a count field that contains the number of documents in the bucket. The count field is included by default when the output is not specified.

        Specified by:
        bucketAuto in interface AggregationPipeline
        Parameters:
        field - the field that used as groupby for auto bucketing
        bucketCount - the number of buckets into which input documents are grouped
        options - options that include granularity for buckets and output
        Returns:
        this
      • geoNear

        public AggregationPipeline geoNear​(GeoNear geoNear)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Returns an ordered stream of documents based on the proximity to a geospatial point. Incorporates the functionality of $match, $sort, and $limit for geospatial data. The output documents include an additional distance field and can include a location identifier field.
        Specified by:
        geoNear in interface AggregationPipeline
        Parameters:
        geoNear - the geospatial parameters to apply to the pipeline
        Returns:
        this
      • group

        public AggregationPipeline group​(Group... groupings)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group . Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields. The ID for this group is null.
        Specified by:
        group in interface AggregationPipeline
        Parameters:
        groupings - the group definitions
        Returns:
        this
      • group

        public AggregationPipeline group​(@Nullable
                                         String id,
                                         Group... groupings)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group. Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields.
        Specified by:
        group in interface AggregationPipeline
        Parameters:
        id - the ID of the group create
        groupings - the group definitions
        Returns:
        this
      • limit

        public AggregationPipeline limit​(int count)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Passes the first n documents unmodified to the pipeline where n is the specified limit. For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents).
        Specified by:
        limit in interface AggregationPipeline
        Parameters:
        count - the maximum number of documents to return
        Returns:
        this
      • lookup

        public AggregationPipeline lookup​(String from,
                                          String localField,
                                          String foreignField,
                                          String as)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing. The $lookup stage does an equality match between a field from the input documents with a field from the documents of the “joined” collection. To each input document, the $lookup stage adds a new array field whose elements are the matching documents from the “joined” collection. The $lookup stage passes these reshaped documents to the next stage.
        Specified by:
        lookup in interface AggregationPipeline
        Parameters:
        from - the collection to join
        localField - the field from the input documents
        foreignField - the field from the documents of the "from" collection
        as - the output array field
        Returns:
        this
      • match

        public AggregationPipeline match​(Query query)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage. $match uses standard MongoDB queries. For each input document, outputs either one document (a match) or zero documents (no match).
        Specified by:
        match in interface AggregationPipeline
        Parameters:
        query - the query to use when matching
        Returns:
        this
      • out

        public <U> Iterator<U> out​(Class<U> target)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Places the output of the aggregation in the collection mapped by the target type using the default options as defined in AggregationOptions.
        Specified by:
        out in interface AggregationPipeline
        Type Parameters:
        U - type of the results
        Parameters:
        target - The class to use when iterating over the results
        Returns:
        an iterator of the computed results
      • out

        public <U> Iterator<U> out​(Class<U> target,
                                   AggregationOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Places the output of the aggregation in the collection mapped by the target type.
        Specified by:
        out in interface AggregationPipeline
        Type Parameters:
        U - type of the results
        Parameters:
        target - The class to use when iterating over the results
        options - The options to apply to this aggregation
        Returns:
        an iterator of the computed results
      • out

        public <U> Iterator<U> out​(String collectionName,
                                   Class<U> target)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Places the output of the aggregation in the collection mapped by the target type using the default options as defined in AggregationOptions.
        Specified by:
        out in interface AggregationPipeline
        Type Parameters:
        U - type of the results
        Parameters:
        collectionName - The collection in which to store the results of the aggregation overriding the mapped value in target
        target - The class to use when iterating over the results
        Returns:
        an iterator of the computed results
      • out

        public <U> Iterator<U> out​(String collectionName,
                                   Class<U> target,
                                   AggregationOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Places the output of the aggregation in the collection mapped by the target type.
        Specified by:
        out in interface AggregationPipeline
        Type Parameters:
        U - type of the results
        Parameters:
        collectionName - The collection in which to store the results of the aggregation overriding the mapped value in target
        target - The class to use when iterating over the results
        options - The options to apply to this aggregation
        Returns:
        an iterator of the computed results
      • project

        public AggregationPipeline project​(Projection... projections)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Reshapes each document in the stream, such as by adding new fields or removing existing fields. For each input document, outputs one document.
        Specified by:
        project in interface AggregationPipeline
        Parameters:
        projections - the projections to apply to this pipeline
        Returns:
        this
      • sample

        public AggregationPipeline sample​(int sampleSize)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Randomly selects the specified number of documents from the previous pipeline stage.
        Specified by:
        sample in interface AggregationPipeline
        Parameters:
        sampleSize - the number of documents to select
        Returns:
        this
      • skip

        public AggregationPipeline skip​(int count)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline. For each input document, outputs either zero documents (for the first n documents) or one document (if after the first n documents).
        Specified by:
        skip in interface AggregationPipeline
        Parameters:
        count - the number of documents to skip
        Returns:
        this
      • sort

        public AggregationPipeline sort​(Sort... sorts)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Reorders the document stream by a specified sort key. Only the order changes; the documents remain unmodified. For each input document, outputs one document.
        Specified by:
        sort in interface AggregationPipeline
        Parameters:
        sorts - the sorts to apply to this pipeline
        Returns:
        this
      • sortByCount

        public AggregationPipeline sortByCount​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group.

        Each output document contains two fields: an _id field containing the distinct grouping value, and a count field containing the number of documents belonging to that grouping or category.

        Specified by:
        sortByCount in interface AggregationPipeline
        Parameters:
        field - the field to sort by count
        Returns:
        this
      • unwind

        public AggregationPipeline unwind​(String field,
                                          UnwindOptions options)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Deconstructs an array field from the input documents to output a document for each element. Each output document replaces the array with an element value. For each input document, outputs n documents where n is the number of array elements and can be zero for an empty array.
        Specified by:
        unwind in interface AggregationPipeline
        Parameters:
        field - the field to unwind
        options - unwind options
        Returns:
        this
      • unwind

        public AggregationPipeline unwind​(String field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: AggregationPipeline
        Deconstructs an array field from the input documents to output a document for each element. Each output document replaces the array with an element value. For each input document, outputs n documents where n is the number of array elements and can be zero for an empty array.
        Specified by:
        unwind in interface AggregationPipeline
        Parameters:
        field - the field to unwind
        Returns:
        this
      • toString

        public String toString()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Overrides:
        toString in class Object