reactivemongo.api.commands

AggregationFramework

trait AggregationFramework[P <: SerializationPack] extends ImplicitCommandHelpers[P] with GroupAggregation[P] with SliceAggregation[P] with SortAggregation[P] with AggregationPipeline[P]

Implements the Aggregation Framework.

Self Type
AggregationFramework[P]
See also

PipelineOperator

Linear Supertypes
AggregationPipeline[P], SortAggregation[P], SliceAggregation[P], GroupAggregation[P], ImplicitCommandHelpers[P], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. AggregationFramework
  2. AggregationPipeline
  3. SortAggregation
  4. SliceAggregation
  5. GroupAggregation
  6. ImplicitCommandHelpers
  7. AnyRef
  8. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class AddFieldToSet extends GroupFunction with Product with Serializable

    The $addToSet group accumulator.

    The $addToSet group accumulator.

    Definition Classes
    GroupAggregation
  2. case class AddFields(specifications: P.Document) extends PipelineOperator with Product with Serializable

    $addFields stage.

  3. case class AddToSet extends GroupFunction with Product with Serializable

    The $addToSet group accumulator.

    The $addToSet group accumulator.

    Definition Classes
    GroupAggregation
  4. case class Ascending extends SortOrder with Product with Serializable

    Ascending sort order

    Ascending sort order

    Definition Classes
    SortAggregation
  5. case class Avg extends GroupFunction with Product with Serializable

    The $avg group accumulator.

    The $avg group accumulator.

    Definition Classes
    GroupAggregation
  6. case class AvgField extends GroupFunction with Product with Serializable

    The $avg group accumulator.

    The $avg group accumulator.

    Definition Classes
    GroupAggregation
  7. case class Bucket(groupBy: P.Value, boundaries: Seq[P.Value], default: String)(output: (String, AggregationFramework.GroupFunction)*) extends PipelineOperator with Product with Serializable

    $bucket aggregation stage.

  8. case class BucketAuto(groupBy: P.Value, buckets: Int, granularity: Option[String])(output: (String, AggregationFramework.GroupFunction)*) extends PipelineOperator with Product with Serializable

    $bucket aggregation stage.

  9. final class ChangeStream extends PipelineOperator

    Low level pipeline operator which allows to open a tailable cursor against subsequent change events of a given collection.

  10. case class CollStats(latencyStatsHistograms: Boolean, storageStatsScale: Option[Double], count: Boolean) extends Product with Serializable

    $collStats aggregation stage.

  11. case class Count(outputName: String) extends PipelineOperator with Product with Serializable

    $count of the number of documents input.

  12. case class CurrentOp(allUsers: Boolean = false, idleConnections: Boolean = false, idleCursors: Boolean = false, idleSessions: Boolean = true, localOps: Boolean = false) extends PipelineOperator with Product with Serializable

    $currentOp.

  13. case class Descending extends SortOrder with Product with Serializable

    Descending sort order

    Descending sort order

    Definition Classes
    SortAggregation
  14. case class Facet(specifications: Iterable[(String, (AggregationFramework.PipelineOperator, List[AggregationFramework.PipelineOperator]))]) extends PipelineOperator with Product with Serializable

    Processes multiple aggregation pipelines within a single stage on the same set of input documents.

  15. case class First extends GroupFunction with Product with Serializable

    The $field group accumulator.

    The $field group accumulator.

    Definition Classes
    GroupAggregation
  16. case class FirstField extends GroupFunction with Product with Serializable

    The $field group accumulator.

    The $field group accumulator.

    Definition Classes
    GroupAggregation
  17. class GeoNear extends PipelineOperator with Product with Serializable

    $geoNear aggregation stage, that outputs documents in order of nearest to farthest from a specified point.

  18. case class GraphLookup(from: String, startWith: P.Value, connectFromField: String, connectToField: String, as: String, maxDepth: Option[Int] = scala.None, depthField: Option[String] = scala.None, restrictSearchWithMatch: Option[P.Value] = scala.None) extends PipelineOperator with Product with Serializable

    The $graphLookup aggregation stage.

  19. case class Group(identifiers: P.Value)(ops: (String, AggregationFramework.GroupFunction)*) extends PipelineOperator with Product with Serializable

    $groups documents together to calculate aggregates on document collections.

  20. case class GroupField(idField: String)(ops: (String, AggregationFramework.GroupFunction)*) extends PipelineOperator with Product with Serializable

    $groups documents together to calculate aggregates on document collections.

  21. sealed trait GroupFunction extends AnyRef

    Represents one of the group/accumulator operators, for the $group aggregation.

    Represents one of the group/accumulator operators, for the $group aggregation. Operation.

    Definition Classes
    GroupAggregation
    See also

    https://docs.mongodb.com/manual/reference/operator/aggregation/group/#accumulator-operator

  22. case class GroupMulti(idFields: (String, String)*)(ops: (String, AggregationFramework.GroupFunction)*) extends PipelineOperator with Product with Serializable

    $groups documents together to calculate aggregates on document collections.

  23. trait ImplicitlyDocumentProducer extends AnyRef

    Definition Classes
    ImplicitCommandHelpers
  24. case class IndexStatAccesses(ops: Long, since: Long) extends Product with Serializable

  25. case class IndexStatsResult(name: String, key: P.Document, host: String, accesses: IndexStatAccesses) extends Product with Serializable

  26. case class Last extends GroupFunction with Product with Serializable

    The $field group accumulator.

    The $field group accumulator.

    Definition Classes
    GroupAggregation
  27. case class LastField extends GroupFunction with Product with Serializable

    The $field group accumulator.

    The $field group accumulator.

    Definition Classes
    GroupAggregation
  28. case class Limit(limit: Int) extends PipelineOperator with Product with Serializable

    $limits the number of documents that pass through the stream.

  29. case class ListLocalSessions(expression: P.Document) extends PipelineOperator with Product with Serializable

    $listLocalSessions aggregation stage.

  30. case class ListSessions(expression: P.Document) extends PipelineOperator with Product with Serializable

    $listSessions aggregation stage.

  31. case class Lookup(from: String, localField: String, foreignField: String, as: String) extends PipelineOperator with Product with Serializable

    Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing.

  32. case class Match(predicate: P.Document) extends PipelineOperator with Product with Serializable

    Filters out documents from the stream that do not match the predicate.

  33. case class Max extends GroupFunction with Product with Serializable

    The $max group accumulator.

    The $max group accumulator.

    Definition Classes
    GroupAggregation
  34. case class MaxField extends GroupFunction with Product with Serializable

    The $max group accumulator.

    The $max group accumulator.

    Definition Classes
    GroupAggregation
  35. case class Merge(intoDb: String, intoCollection: String, on: Seq[String], whenMatched: Option[String], let: Option[P.Document], whenNotMatched: Option[String]) extends PipelineOperator with Product with Serializable

    $merge aggregation stage.

  36. case class MergeObjects extends GroupFunction with Product with Serializable

    The $mergeObjects group accumulator.

    The $mergeObjects group accumulator.

    Definition Classes
    GroupAggregation
  37. sealed trait MetadataKeyword extends AnyRef

    Keyword of metadata.

    Definition Classes
    SortAggregation
  38. case class MetadataSort extends SortOrder with Product with Serializable

    Metadata sort order.

    Definition Classes
    SortAggregation
  39. case class Min extends GroupFunction with Product with Serializable

    The $min group accumulator.

    The $min group accumulator.

    Definition Classes
    GroupAggregation
  40. case class MinField extends GroupFunction with Product with Serializable

    The $min group accumulator.

    The $min group accumulator.

    Definition Classes
    GroupAggregation
  41. case class Out(collection: String) extends PipelineOperator with Product with Serializable

    Takes the documents returned by the aggregation pipeline and writes them to a specified collection

  42. type Pipeline = (PipelineOperator, List[PipelineOperator])

    Aggregation pipeline (with at least one stage operator)

    Aggregation pipeline (with at least one stage operator)

    Definition Classes
    AggregationPipeline
  43. trait PipelineOperator extends AnyRef

    One of MongoDBs pipeline operators for aggregation.

    One of MongoDBs pipeline operators for aggregation. Sealed as these are defined in the MongoDB specifications, and clients should not have custom operators.

    Definition Classes
    AggregationPipeline
  44. case class Project(specifications: P.Document) extends PipelineOperator with Product with Serializable

    Reshapes a document stream by renaming, adding, or removing fields.

  45. case class Push extends GroupFunction with Product with Serializable

    The $push group accumulator.

    The $push group accumulator.

    Definition Classes
    GroupAggregation
  46. case class PushField extends GroupFunction with Product with Serializable

    The $push group accumulator.

    The $push group accumulator.

    Definition Classes
    GroupAggregation
  47. case class Redact(expression: P.Document) extends PipelineOperator with Product with Serializable

    Restricts the contents of the documents based on information stored in the documents themselves.

  48. case class ReplaceRoot(newRoot: P.Document) extends PipelineOperator with Product with Serializable

    Promotes a specified document to the top level and replaces all other fields.

  49. case class ReplaceRootField(newRoot: String) extends PipelineOperator with Product with Serializable

    Promotes a specified document to the top level and replaces all other fields.

  50. case class ReplaceWith(replacementDocument: P.Document) extends PipelineOperator with Product with Serializable

    The $replaceWith aggregation stage.

  51. case class Sample(size: Int) extends PipelineOperator with Product with Serializable

    $sample aggregation stage, that randomly selects the specified number of documents from its input.

  52. case class Set(expression: P.Document) extends PipelineOperator with Product with Serializable

    $set aggregation stage

  53. case class Skip(skip: Int) extends PipelineOperator with Product with Serializable

    $skips over a number of documents before passing all further documents along the stream.

  54. final class Slice extends PipelineOperator

    Returns a subset of an array.

    Returns a subset of an array. https://docs.mongodb.com/manual/reference/operator/aggregation/slice/

    Definition Classes
    SliceAggregation
  55. case class Sort(fields: AggregationFramework.SortOrder*) extends PipelineOperator with Product with Serializable

    $sorts the stream based on the given fields.

  56. case class SortByCount(expression: P.Value) extends PipelineOperator with Product with Serializable

    The $sortByCount aggregation stage.

  57. case class SortByFieldCount(field: String) extends PipelineOperator with Product with Serializable

    The $sortByCount aggregation stage.

  58. sealed trait SortOrder extends AnyRef

    Represents that a field should be sorted on, as well as whether it should be ascending or descending.

    Represents that a field should be sorted on, as well as whether it should be ascending or descending.

    Definition Classes
    SortAggregation
  59. case class StdDevPop extends GroupFunction with Product with Serializable

    The $stdDevPop group accumulator.

    The $stdDevPop group accumulator.

    Definition Classes
    GroupAggregation
    Since

    MongoDB 3.2

  60. case class StdDevPopField extends GroupFunction with Product with Serializable

    The $stdDevPop for a single field.

    The $stdDevPop for a single field.

    Definition Classes
    GroupAggregation
    Since

    MongoDB 3.2

  61. case class StdDevSamp extends GroupFunction with Product with Serializable

    The $stdDevSamp group accumulator

    The $stdDevSamp group accumulator

    Definition Classes
    GroupAggregation
    Since

    MongoDB 3.2

  62. case class StdDevSampField extends GroupFunction with Product with Serializable

    The $stdDevSamp for a single field

    The $stdDevSamp for a single field

    Definition Classes
    GroupAggregation
    Since

    MongoDB 3.2

  63. case class Sum extends GroupFunction with Product with Serializable

    The $sum group accumulator.

    The $sum group accumulator.

    Definition Classes
    GroupAggregation
  64. case class SumField extends GroupFunction with Product with Serializable

    The $sum group accumulator.

    The $sum group accumulator.

    Definition Classes
    GroupAggregation
  65. case class Unset(field: String, otherFields: Seq[String]) extends PipelineOperator with Product with Serializable

    The $unset aggregation stage.

  66. class Unwind extends PipelineOperator with Product with Serializable

  67. case class UnwindField(field: String) extends Unwind with Product with Serializable

    Turns a document with an array into multiple documents, one document for each element in the array.

  68. case class Aggregate(pipeline: Seq[AggregationFramework.PipelineOperator], explain: Boolean = false, allowDiskUse: Boolean, cursor: Option[Cursor], wireVersion: MongoWireVersion, bypassDocumentValidation: Boolean, readConcern: Option[ReadConcern]) extends CollectionCommand with CommandWithPack[pack.type] with CommandWithResult[AggregationResult] with Product with Serializable

  69. case class AggregationResult(firstBatch: List[P.Document], cursor: Option[ResultCursor] = scala.None) extends Product with Serializable

  70. case class Cursor(batchSize: Int) extends Product with Serializable

  71. case class Filter(input: P.Value, as: String, cond: P.Document) extends PipelineOperator with Product with Serializable

    The $filter aggregation stage.

  72. case class SumValue extends GroupFunction with Product with Serializable

    Definition Classes
    GroupAggregation
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.0) Use SumAll

Abstract Value Members

  1. abstract val pack: P

    Definition Classes
    AggregationPipeline

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (AggregationFramework[P], B)

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to ArrowAssoc[AggregationFramework[P]] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. object Filter extends Serializable

    Filter companion

  9. object GeoNear extends Serializable

  10. object GroupFunction

    Factory to declare custom call to a group function.

    Factory to declare custom call to a group function.

    Definition Classes
    GroupAggregation
  11. object ImplicitlyDocumentProducer

    Definition Classes
    ImplicitCommandHelpers
  12. object IndexStats extends PipelineOperator with Product with Serializable

    $indexStats aggregation stage.

  13. object PipelineOperator

    Only for advanced user: Factory for stage not already provided in the API.

    Only for advanced user: Factory for stage not already provided in the API.

    For example for { $sample: { size: 2 } }

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.bson.{ BSONDocument, BSONInteger, BSONString }
    import reactivemongo.api.bson.collection.BSONCollection
    
    def foo(coll: BSONCollection)(implicit ec: ExecutionContext) =
      coll.aggregateWith[BSONDocument]() { agg =>
        import agg.PipelineOperator
    
        val stage = PipelineOperator(BSONDocument(
          f"$$sample" -> BSONDocument("size" -> 2)))
    
        stage -> List.empty
      }
    Definition Classes
    AggregationPipeline
  14. object PlanCacheStats extends PipelineOperator with Product with Serializable

    $planCacheStats aggregation stage.

  15. object Slice

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.bson.{ BSONDocument, BSONInteger, BSONString }
    import reactivemongo.api.bson.collection.BSONCollection
    
    def foo(coll: BSONCollection)(implicit ec: ExecutionContext) = {
      coll.aggregateWith[BSONDocument]() { agg =>
        import agg.{ Project, Slice }
    
        // Define the pipeline stages
        Project(BSONDocument(
          "name" -> 1,
          "favorites" -> Slice(
            array = BSONString(f"$$favorites"),
            n = BSONInteger(3)).makePipe)) -> List.empty
      }
    }
    Definition Classes
    SliceAggregation
  16. object SumAll extends GroupFunction with Product with Serializable

    The $sum: 1 group accumulator.

    The $sum: 1 group accumulator.

    Definition Classes
    GroupAggregation
  17. object TextScore extends MetadataKeyword with Product with Serializable

    References the score associated with the corresponding $text query for each matching document.

    References the score associated with the corresponding $text query for each matching document.

    Definition Classes
    SortAggregation
  18. object Unwind extends Serializable

  19. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  20. final lazy val builder: Builder[pack.type]

    Attributes
    protected
  21. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. def ensuring(cond: (AggregationFramework[P]) ⇒ Boolean, msg: ⇒ Any): AggregationFramework[P]

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to Ensuring[AggregationFramework[P]] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  23. def ensuring(cond: (AggregationFramework[P]) ⇒ Boolean): AggregationFramework[P]

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to Ensuring[AggregationFramework[P]] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  24. def ensuring(cond: Boolean, msg: ⇒ Any): AggregationFramework[P]

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to Ensuring[AggregationFramework[P]] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  25. def ensuring(cond: Boolean): AggregationFramework[P]

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to Ensuring[AggregationFramework[P]] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  26. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  28. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  29. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  30. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  31. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  32. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  33. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  34. final def notify(): Unit

    Definition Classes
    AnyRef
  35. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  36. final def pipe(name: String, arg: P.Value): P.Document

    Attributes
    protected
    Annotations
    @inline()
  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  38. def toString(): String

    Definition Classes
    AnyRef → Any
  39. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. def [B](y: B): (AggregationFramework[P], B)

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to ArrowAssoc[AggregationFramework[P]] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (aggregationFramework: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (aggregationFramework: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: AggregationFramework[P]

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to ArrowAssoc[AggregationFramework[P]] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (aggregationFramework: ArrowAssoc[AggregationFramework[P]]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: AggregationFramework[P]

    Implicit information
    This member is added by an implicit conversion from AggregationFramework[P] to Ensuring[AggregationFramework[P]] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (aggregationFramework: Ensuring[AggregationFramework[P]]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from AggregationPipeline[P]

Inherited from SortAggregation[P]

Inherited from SliceAggregation[P]

Inherited from GroupAggregation[P]

Inherited from ImplicitCommandHelpers[P]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from AggregationFramework[P] to StringAdd

Inherited by implicit conversion any2stringfmt from AggregationFramework[P] to StringFormat

Inherited by implicit conversion any2ArrowAssoc from AggregationFramework[P] to ArrowAssoc[AggregationFramework[P]]

Inherited by implicit conversion any2Ensuring from AggregationFramework[P] to Ensuring[AggregationFramework[P]]

Ungrouped