Class Aggregates


  • @Deprecated(since="2021-05-27")
    public final class Aggregates
    extends java.lang.Object
    Deprecated.
    Usage of this API is not supported in AEM as a Cloud Service.
    Builders for aggregation pipeline stages.
    Since:
    3.1
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static Bson addFields​(Field<?>... fields)
      Deprecated.
      Creates an $addFields pipeline stage
      static Bson addFields​(java.util.List<Field<?>> fields)
      Deprecated.
      Creates an $addFields pipeline stage
      static <TExpression,​Boundary>
      Bson
      bucket​(TExpression groupBy, java.util.List<Boundary> boundaries)
      Deprecated.
      Creates a $bucket pipeline stage
      static <TExpression,​TBoundary>
      Bson
      bucket​(TExpression groupBy, java.util.List<TBoundary> boundaries, BucketOptions options)
      Deprecated.
      Creates a $bucket pipeline stage
      static <TExpression>
      Bson
      bucketAuto​(TExpression groupBy, int buckets)
      Deprecated.
      Creates a $bucketAuto pipeline stage
      static <TExpression>
      Bson
      bucketAuto​(TExpression groupBy, int buckets, BucketAutoOptions options)
      Deprecated.
      Creates a $bucketAuto pipeline stage
      static Bson count()
      Deprecated.
      Creates a $count pipeline stage using the field name "count" to store the result
      static Bson count​(java.lang.String field)
      Deprecated.
      Creates a $count pipeline stage using the named field to store the result
      static Bson facet​(Facet... facets)
      Deprecated.
      Creates a facet pipeline stage
      static Bson facet​(java.util.List<Facet> facets)
      Deprecated.
      Creates a facet pipeline stage
      static <TExpression>
      Bson
      graphLookup​(java.lang.String from, TExpression startWith, java.lang.String connectFromField, java.lang.String connectToField, java.lang.String as)
      Deprecated.
      Creates a graphLookup pipeline stage for the specified filter
      static <TExpression>
      Bson
      graphLookup​(java.lang.String from, TExpression startWith, java.lang.String connectFromField, java.lang.String connectToField, java.lang.String as, GraphLookupOptions options)
      Deprecated.
      Creates a graphLookup pipeline stage for the specified filter
      static <TExpression>
      Bson
      group​(TExpression id, BsonField... fieldAccumulators)
      Deprecated.
      Creates a $group pipeline stage for the specified filter
      static <TExpression>
      Bson
      group​(TExpression id, java.util.List<BsonField> fieldAccumulators)
      Deprecated.
      Creates a $group pipeline stage for the specified filter
      static Bson limit​(int limit)
      Deprecated.
      Creates a $limit pipeline stage for the specified filter
      static Bson lookup​(java.lang.String from, java.lang.String localField, java.lang.String foreignField, java.lang.String as)
      Deprecated.
      Creates a $lookup pipeline stage, joining the current collection with the one specified in from using equality match between the local field and the foreign field
      static Bson lookup​(java.lang.String from, java.util.List<? extends Bson> pipeline, java.lang.String as)
      Deprecated.
      Creates a $lookup pipeline stage, joining the current collection with the one specified in from using the given pipeline
      static <TExpression>
      Bson
      lookup​(java.lang.String from, java.util.List<Variable<TExpression>> let, java.util.List<? extends Bson> pipeline, java.lang.String as)
      Deprecated.
      Creates a $lookup pipeline stage, joining the current collection with the one specified in from using the given pipeline
      static Bson match​(Bson filter)
      Deprecated.
      Creates a $match pipeline stage for the specified filter
      static Bson merge​(MongoNamespace namespace)
      Deprecated.
      Creates a $merge pipeline stage that merges into the specified namespace
      static Bson merge​(MongoNamespace namespace, MergeOptions options)
      Deprecated.
      Creates a $merge pipeline stage that merges into the specified namespace using the specified options.
      static Bson merge​(java.lang.String collectionName)
      Deprecated.
      Creates a $merge pipeline stage that merges into the specified collection
      static Bson merge​(java.lang.String collectionName, MergeOptions options)
      Deprecated.
      Creates a $merge pipeline stage that merges into the specified collection using the specified options.
      static Bson out​(java.lang.String collectionName)
      Deprecated.
      Creates a $out pipeline stage that writes into the specified collection
      static Bson project​(Bson projection)
      Deprecated.
      Creates a $project pipeline stage for the specified projection
      static <TExpression>
      Bson
      replaceRoot​(TExpression value)
      Deprecated.
      Creates a $replaceRoot pipeline stage
      static <TExpression>
      Bson
      replaceWith​(TExpression value)
      Deprecated.
      Creates a $replaceRoot pipeline stage
      static Bson sample​(int size)
      Deprecated.
      Creates a $sample pipeline stage with the specified sample size
      static Bson skip​(int skip)
      Deprecated.
      Creates a $skip pipeline stage
      static Bson sort​(Bson sort)
      Deprecated.
      Creates a $sort pipeline stage for the specified sort specification
      static <TExpression>
      Bson
      sortByCount​(TExpression filter)
      Deprecated.
      Creates a $sortByCount pipeline stage for the specified filter
      static Bson unwind​(java.lang.String fieldName)
      Deprecated.
      Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a '$' sign.
      static Bson unwind​(java.lang.String fieldName, UnwindOptions unwindOptions)
      Deprecated.
      Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a '$' sign.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • addFields

        public static Bson addFields​(Field<?>... fields)
        Deprecated.
        Creates an $addFields pipeline stage
        Parameters:
        fields - the fields to add
        Returns:
        the $addFields pipeline stage
        Since:
        3.4
      • addFields

        public static Bson addFields​(java.util.List<Field<?>> fields)
        Deprecated.
        Creates an $addFields pipeline stage
        Parameters:
        fields - the fields to add
        Returns:
        the $addFields pipeline stage
        Since:
        3.4
      • bucket

        public static <TExpression,​Boundary> Bson bucket​(TExpression groupBy,
                                                               java.util.List<Boundary> boundaries)
        Deprecated.
        Creates a $bucket pipeline stage
        Type Parameters:
        TExpression - the groupBy expression type
        Boundary - the boundary type
        Parameters:
        groupBy - the criteria to group By
        boundaries - the boundaries of the buckets
        Returns:
        the $bucket pipeline stage
        Since:
        3.4
      • bucket

        public static <TExpression,​TBoundary> Bson bucket​(TExpression groupBy,
                                                                java.util.List<TBoundary> boundaries,
                                                                BucketOptions options)
        Deprecated.
        Creates a $bucket pipeline stage
        Type Parameters:
        TExpression - the groupBy expression type
        TBoundary - the boundary type
        Parameters:
        groupBy - the criteria to group By
        boundaries - the boundaries of the buckets
        options - the optional values for the $bucket stage
        Returns:
        the $bucket pipeline stage
        Since:
        3.4
      • bucketAuto

        public static <TExpression> Bson bucketAuto​(TExpression groupBy,
                                                    int buckets)
        Deprecated.
        Creates a $bucketAuto pipeline stage
        Type Parameters:
        TExpression - the groupBy expression type
        Parameters:
        groupBy - the criteria to group By
        buckets - the number of the buckets
        Returns:
        the $bucketAuto pipeline stage
        Since:
        3.4
      • bucketAuto

        public static <TExpression> Bson bucketAuto​(TExpression groupBy,
                                                    int buckets,
                                                    BucketAutoOptions options)
        Deprecated.
        Creates a $bucketAuto pipeline stage
        Type Parameters:
        TExpression - the groupBy expression type
        Parameters:
        groupBy - the criteria to group By
        buckets - the number of the buckets
        options - the optional values for the $bucketAuto stage
        Returns:
        the $bucketAuto pipeline stage
        Since:
        3.4
      • count

        public static Bson count()
        Deprecated.
        Creates a $count pipeline stage using the field name "count" to store the result
        Returns:
        the $count pipeline stage
        Since:
        3.4
      • count

        public static Bson count​(java.lang.String field)
        Deprecated.
        Creates a $count pipeline stage using the named field to store the result
        Parameters:
        field - the field in which to store the count
        Returns:
        the $count pipeline stage
        Since:
        3.4
      • match

        public static Bson match​(Bson filter)
        Deprecated.
        Creates a $match pipeline stage for the specified filter
        Parameters:
        filter - the filter to match
        Returns:
        the $match pipeline stage
        See Also:
        Filters
      • project

        public static Bson project​(Bson projection)
        Deprecated.
        Creates a $project pipeline stage for the specified projection
        Parameters:
        projection - the projection
        Returns:
        the $project pipeline stage
        See Also:
        Projections
      • sort

        public static Bson sort​(Bson sort)
        Deprecated.
        Creates a $sort pipeline stage for the specified sort specification
        Parameters:
        sort - the sort specification
        Returns:
        the $sort pipeline stage
        See Also:
        Sorts
      • sortByCount

        public static <TExpression> Bson sortByCount​(TExpression filter)
        Deprecated.
        Creates a $sortByCount pipeline stage for the specified filter
        Type Parameters:
        TExpression - the expression type
        Parameters:
        filter - the filter specification
        Returns:
        the $sortByCount pipeline stage
        Since:
        3.4
      • skip

        public static Bson skip​(int skip)
        Deprecated.
        Creates a $skip pipeline stage
        Parameters:
        skip - the number of documents to skip
        Returns:
        the $skip pipeline stage
      • limit

        public static Bson limit​(int limit)
        Deprecated.
        Creates a $limit pipeline stage for the specified filter
        Parameters:
        limit - the limit
        Returns:
        the $limit pipeline stage
      • lookup

        public static Bson lookup​(java.lang.String from,
                                  java.lang.String localField,
                                  java.lang.String foreignField,
                                  java.lang.String as)
        Deprecated.
        Creates a $lookup pipeline stage, joining the current collection with the one specified in from using equality match between the local field and the foreign field
        Parameters:
        from - the name of the collection in the same database to perform the join with.
        localField - the field from the local collection to match values against.
        foreignField - the field in the from collection to match values against.
        as - the name of the new array field to add to the input documents.
        Returns:
        the $lookup pipeline stage
        Since:
        3.2
      • lookup

        public static Bson lookup​(java.lang.String from,
                                  java.util.List<? extends Bson> pipeline,
                                  java.lang.String as)
        Deprecated.
        Creates a $lookup pipeline stage, joining the current collection with the one specified in from using the given pipeline
        Parameters:
        from - the name of the collection in the same database to perform the join with.
        pipeline - the pipeline to run on the joined collection.
        as - the name of the new array field to add to the input documents.
        Returns:
        the $lookup pipeline stage
        Since:
        3.7
      • lookup

        public static <TExpression> Bson lookup​(java.lang.String from,
                                                @Nullable
                                                java.util.List<Variable<TExpression>> let,
                                                java.util.List<? extends Bson> pipeline,
                                                java.lang.String as)
        Deprecated.
        Creates a $lookup pipeline stage, joining the current collection with the one specified in from using the given pipeline
        Type Parameters:
        TExpression - the Variable value expression type
        Parameters:
        from - the name of the collection in the same database to perform the join with.
        let - the variables to use in the pipeline field stages.
        pipeline - the pipeline to run on the joined collection.
        as - the name of the new array field to add to the input documents.
        Returns:
        the $lookup pipeline stage
        Since:
        3.7
      • facet

        public static Bson facet​(java.util.List<Facet> facets)
        Deprecated.
        Creates a facet pipeline stage
        Parameters:
        facets - the facets to use
        Returns:
        the new pipeline stage
        Since:
        3.4
      • facet

        public static Bson facet​(Facet... facets)
        Deprecated.
        Creates a facet pipeline stage
        Parameters:
        facets - the facets to use
        Returns:
        the new pipeline stage
        Since:
        3.4
      • graphLookup

        public static <TExpression> Bson graphLookup​(java.lang.String from,
                                                     TExpression startWith,
                                                     java.lang.String connectFromField,
                                                     java.lang.String connectToField,
                                                     java.lang.String as)
        Deprecated.
        Creates a graphLookup pipeline stage for the specified filter
        Type Parameters:
        TExpression - the expression type
        Parameters:
        from - the collection to query
        startWith - the expression to start the graph lookup with
        connectFromField - the from field
        connectToField - the to field
        as - name of field in output document
        Returns:
        the $graphLookup pipeline stage
        Since:
        3.4
      • graphLookup

        public static <TExpression> Bson graphLookup​(java.lang.String from,
                                                     TExpression startWith,
                                                     java.lang.String connectFromField,
                                                     java.lang.String connectToField,
                                                     java.lang.String as,
                                                     GraphLookupOptions options)
        Deprecated.
        Creates a graphLookup pipeline stage for the specified filter
        Type Parameters:
        TExpression - the expression type
        Parameters:
        from - the collection to query
        startWith - the expression to start the graph lookup with
        connectFromField - the from field
        connectToField - the to field
        as - name of field in output document
        options - optional values for the graphLookup
        Returns:
        the $graphLookup pipeline stage
        Since:
        3.4
      • group

        public static <TExpression> Bson group​(@Nullable
                                               TExpression id,
                                               BsonField... fieldAccumulators)
        Deprecated.
        Creates a $group pipeline stage for the specified filter
        Type Parameters:
        TExpression - the expression type
        Parameters:
        id - the id expression for the group, which may be null
        fieldAccumulators - zero or more field accumulator pairs
        Returns:
        the $group pipeline stage
      • group

        public static <TExpression> Bson group​(@Nullable
                                               TExpression id,
                                               java.util.List<BsonField> fieldAccumulators)
        Deprecated.
        Creates a $group pipeline stage for the specified filter
        Type Parameters:
        TExpression - the expression type
        Parameters:
        id - the id expression for the group, which may be null
        fieldAccumulators - zero or more field accumulator pairs
        Returns:
        the $group pipeline stage
      • unwind

        public static Bson unwind​(java.lang.String fieldName)
        Deprecated.
        Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a '$' sign.
        Parameters:
        fieldName - the field name, prefixed by a '$' sign
        Returns:
        the $unwind pipeline stage
      • unwind

        public static Bson unwind​(java.lang.String fieldName,
                                  UnwindOptions unwindOptions)
        Deprecated.
        Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a '$' sign.
        Parameters:
        fieldName - the field name, prefixed by a '$' sign
        unwindOptions - options for the unwind pipeline stage
        Returns:
        the $unwind pipeline stage
        Since:
        3.2
      • out

        public static Bson out​(java.lang.String collectionName)
        Deprecated.
        Creates a $out pipeline stage that writes into the specified collection
        Parameters:
        collectionName - the collection name
        Returns:
        the $out pipeline stage
      • merge

        public static Bson merge​(java.lang.String collectionName)
        Deprecated.
        Creates a $merge pipeline stage that merges into the specified collection
        Parameters:
        collectionName - the name of the collection to merge into
        Returns:
        the $merge pipeline stage
        Since:
        3.11
      • merge

        public static Bson merge​(MongoNamespace namespace)
        Deprecated.
        Creates a $merge pipeline stage that merges into the specified namespace
        Parameters:
        namespace - the namespace to merge into
        Returns:
        the $merge pipeline stage
        Since:
        3.11
      • merge

        public static Bson merge​(java.lang.String collectionName,
                                 MergeOptions options)
        Deprecated.
        Creates a $merge pipeline stage that merges into the specified collection using the specified options.
        Parameters:
        collectionName - the name of the collection to merge into
        options - the merge options
        Returns:
        the $merge pipeline stage
        Since:
        3.11
      • merge

        public static Bson merge​(MongoNamespace namespace,
                                 MergeOptions options)
        Deprecated.
        Creates a $merge pipeline stage that merges into the specified namespace using the specified options.
        Parameters:
        namespace - the namespace to merge into
        options - the merge options
        Returns:
        the $merge pipeline stage
        Since:
        3.11
      • replaceRoot

        public static <TExpression> Bson replaceRoot​(TExpression value)
        Deprecated.
        Creates a $replaceRoot pipeline stage
        Type Parameters:
        TExpression - the new root type
        Parameters:
        value - the new root value
        Returns:
        the $replaceRoot pipeline stage
        Since:
        3.4
      • replaceWith

        public static <TExpression> Bson replaceWith​(TExpression value)
        Deprecated.
        Creates a $replaceRoot pipeline stage

        With $replaceWith, you can promote an embedded document to the top-level. You can also specify a new document as the replacement.

        The $replaceWith is an alias for replaceRoot(Object).

        Type Parameters:
        TExpression - the new root type
        Parameters:
        value - the new root value
        Returns:
        the $replaceRoot pipeline stage
        Since:
        3.11
      • sample

        public static Bson sample​(int size)
        Deprecated.
        Creates a $sample pipeline stage with the specified sample size
        Parameters:
        size - the sample size
        Returns:
        the $sample pipeline stage
        Since:
        3.2