trait AggregationFramework[P <: SerializationPack] extends GroupAggregation[P] with SliceAggregation[P] with SortAggregation[P] with AggregationPipeline[P] with ChangeStreamAggregation[P] with AtlasSearchAggregation[P]
Implements the Aggregation Framework.
- Self Type
- AggregationFramework[P] with PackSupport[P]
- See also
- Alphabetic
- By Inheritance
- AggregationFramework
- AtlasSearchAggregation
- ChangeStreamAggregation
- AggregationPipeline
- SortAggregation
- SliceAggregation
- GroupAggregation
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Type Members
- final class AddFieldToSet extends GroupFunction
The $addToSet group accumulator.
The $addToSet group accumulator.
- Definition Classes
- GroupAggregation
- final class AddFields extends (AggregationFramework.this)#PipelineOperator
$addFields stage .
- final class AddToSet extends GroupFunction
The $addToSet group accumulator.
The $addToSet group accumulator.
- Definition Classes
- GroupAggregation
- final class Ascending extends SortOrder
Ascending sort order
Ascending sort order
- Definition Classes
- SortAggregation
- final class AtlasSearch extends PipelineOperator
EXPERIMENTAL: See AtlasSearch$
EXPERIMENTAL: See AtlasSearch$
- Definition Classes
- AtlasSearchAggregation
- final class Avg extends GroupFunction
The $avg group accumulator.
The $avg group accumulator.
- Definition Classes
- GroupAggregation
- final class AvgField extends GroupFunction
The $avg group accumulator.
The $avg group accumulator.
- Definition Classes
- GroupAggregation
- final class Bucket extends (AggregationFramework.this)#PipelineOperator
$bucket aggregation stage .
- final class BucketAuto extends (AggregationFramework.this)#PipelineOperator
$bucket aggregation stage .
- final class CollStats extends (AggregationFramework.this)#PipelineOperator
$collStats aggregation stage .
- final class Count extends (AggregationFramework.this)#PipelineOperator
$count of the number of documents input .
- final class CurrentOp extends (AggregationFramework.this)#PipelineOperator
- final class Cursor extends AnyRef
- Attributes
- protected
- final class Descending extends SortOrder
Descending sort order
Descending sort order
- Definition Classes
- SortAggregation
- final class Facet extends (AggregationFramework.this)#PipelineOperator
$facet .
- final class Filter extends AnyRef
The $filter aggregation stage.
- final class First extends GroupFunction
The $field group accumulator.
The $field group accumulator.
- Definition Classes
- GroupAggregation
- final class FirstField extends GroupFunction
The $field group accumulator.
The $field group accumulator.
- Definition Classes
- GroupAggregation
- final class GeoNear extends (AggregationFramework.this)#PipelineOperator
$geoNear aggregation stage, that outputs documents in order of nearest to farthest from a specified point.
- final class GraphLookup extends (AggregationFramework.this)#PipelineOperator
The $graphLookup aggregation stage.
The $graphLookup aggregation stage.
- Since
MongoDB 3.4
- final class Group extends (AggregationFramework.this)#PipelineOperator
$groups documents together to calculate aggregates on document collections .
- final class GroupField extends (AggregationFramework.this)#PipelineOperator
$groups documents together to calculate aggregates on document collections.
$groups documents together to calculate aggregates on document collections. This command aggregates on one field.
- 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
- final class GroupMulti extends (AggregationFramework.this)#PipelineOperator
$groups documents together to calculate aggregates on document collections.
$groups documents together to calculate aggregates on document collections. This command aggregates on multiple fields, and they must be named.
- final class IndexStatAccesses extends AnyRef
- final class IndexStatsResult extends AnyRef
- final class Last extends GroupFunction
The $field group accumulator.
The $field group accumulator.
- Definition Classes
- GroupAggregation
- final class LastField extends GroupFunction
The $field group accumulator.
The $field group accumulator.
- Definition Classes
- GroupAggregation
- final class Limit extends (AggregationFramework.this)#PipelineOperator
$limits the number of documents that pass through the stream.
- final class ListLocalSessions extends (AggregationFramework.this)#PipelineOperator
$listLocalSessions aggregation stage.
$listLocalSessions aggregation stage.
- Since
MongoDB 3.6
- final class ListSessions extends (AggregationFramework.this)#PipelineOperator
$listSessions aggregation stage.
$listSessions aggregation stage.
- Since
MongoDB 3.6
- final class Lookup extends (AggregationFramework.this)#PipelineOperator
Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing .
Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing .
- See also
- final class LookupPipeline extends (AggregationFramework.this)#PipelineOperator
Performs an uncorrelated lookup .
Performs an uncorrelated lookup .
- See also
- final class Match extends (AggregationFramework.this)#PipelineOperator
Filters out documents from the stream that do not match the predicate.
- final class Max extends GroupFunction
The $max group accumulator.
The $max group accumulator.
- Definition Classes
- GroupAggregation
- final class MaxField extends GroupFunction
The $max group accumulator.
The $max group accumulator.
- Definition Classes
- GroupAggregation
- final class Merge extends (AggregationFramework.this)#PipelineOperator
$merge aggregation stage.
$merge aggregation stage.
- Since
MongoDB 4.2
- final class MergeObjects extends GroupFunction
The $mergeObjects group accumulator.
The $mergeObjects group accumulator.
- Definition Classes
- GroupAggregation
- sealed trait MetadataKeyword extends AnyRef
- Definition Classes
- SortAggregation
- final class MetadataSort extends SortOrder
Metadata sort order.
Metadata sort order.
- Definition Classes
- SortAggregation
- final class Min extends GroupFunction
The $min group accumulator.
The $min group accumulator.
- Definition Classes
- GroupAggregation
- final class MinField extends GroupFunction
The $min group accumulator.
The $min group accumulator.
- Definition Classes
- GroupAggregation
- final class Out extends (AggregationFramework.this)#PipelineOperator
Takes the documents returned by the aggregation pipeline and writes them to a specified collection
- type Pipeline = List[(AggregationFramework.this)#PipelineOperator]
Aggregation pipeline (with at least one stage operator)
Aggregation pipeline (with at least one stage operator)
- Definition Classes
- AggregationPipeline
- 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
- final class Project extends (AggregationFramework.this)#PipelineOperator
Reshapes a document stream by renaming, adding, or removing fields.
Reshapes a document stream by renaming, adding, or removing fields. Also uses Project to create computed values or sub-objects.
- final class Push extends GroupFunction
The $push group accumulator.
The $push group accumulator.
- Definition Classes
- GroupAggregation
- final class PushField extends GroupFunction
The $push group accumulator.
The $push group accumulator.
- Definition Classes
- GroupAggregation
- final class Redact extends (AggregationFramework.this)#PipelineOperator
Restricts the contents of the documents based on information stored in the documents themselves.
Restricts the contents of the documents based on information stored in the documents themselves. http://docs.mongodb.org/manual/reference/operator/aggregation/redact/#pipe._S_redact Redact
- final class ReplaceRoot extends (AggregationFramework.this)#PipelineOperator
Promotes a specified document to the top level and replaces all other fields.
Promotes a specified document to the top level and replaces all other fields. The operation replaces all existing fields in the input document, including the _id field. https://docs.mongodb.com/manual/reference/operator/aggregation/replaceRoot
- final class ReplaceRootField extends (AggregationFramework.this)#PipelineOperator
Promotes a specified document to the top level and replaces all other fields.
Promotes a specified document to the top level and replaces all other fields. The operation replaces all existing fields in the input document, including the _id field. https://docs.mongodb.com/manual/reference/operator/aggregation/replaceRoot
- final class ReplaceWith extends (AggregationFramework.this)#PipelineOperator
The $replaceWith aggregation stage.
The $replaceWith aggregation stage.
- Since
MongoDB 4.2
- final class Sample extends (AggregationFramework.this)#PipelineOperator
$sample aggregation stage, that randomly selects the specified number of documents from its input.
- final class SearchString extends AnyRef
EXPERIMENTAL: One or at least one string with optional alternate analyzer specified in multi field
EXPERIMENTAL: One or at least one string with optional alternate analyzer specified in multi field
- Definition Classes
- AtlasSearchAggregation
- final class Set extends (AggregationFramework.this)#PipelineOperator
$set aggregation stage
- final class Skip extends (AggregationFramework.this)#PipelineOperator
$skips over a number of documents before passing all further documents along the stream.
- final class Slice extends PipelineOperator
Returns a slice/subset of an array.
Returns a slice/subset of an array.
- Definition Classes
- SliceAggregation
- final class Sort extends (AggregationFramework.this)#PipelineOperator
$sorts the stream based on the given fields.
- final class SortByCount extends (AggregationFramework.this)#PipelineOperator
The $sortByCount aggregation stage.
The $sortByCount aggregation stage.
- Since
MongoDB 3.4
- final class SortByFieldCount extends (AggregationFramework.this)#PipelineOperator
The $sortByCount aggregation stage.
The $sortByCount aggregation stage.
- Since
MongoDB 3.4
- 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
- final class StdDevPop extends GroupFunction
The $stdDevPop group accumulator.
The $stdDevPop group accumulator.
- Definition Classes
- GroupAggregation
- Since
MongoDB 3.2
- final class StdDevPopField extends GroupFunction
The $stdDevPop for a single field.
The $stdDevPop for a single field.
- Definition Classes
- GroupAggregation
- Since
MongoDB 3.2
- final class StdDevSamp extends GroupFunction
The $stdDevSamp group accumulator
The $stdDevSamp group accumulator
- Definition Classes
- GroupAggregation
- Since
MongoDB 3.2
- final class StdDevSampField extends GroupFunction
The $stdDevSamp for a single field
The $stdDevSamp for a single field
- Definition Classes
- GroupAggregation
- Since
MongoDB 3.2
- final class Sum extends GroupFunction
The $sum group accumulator.
The $sum group accumulator.
- Definition Classes
- GroupAggregation
- final class SumField extends GroupFunction
The $sum group accumulator.
The $sum group accumulator.
- Definition Classes
- GroupAggregation
- final class SumValue extends GroupFunction
- Definition Classes
- GroupAggregation
- final class Unset extends (AggregationFramework.this)#PipelineOperator
The $unset aggregation stage.
The $unset aggregation stage.
- Since
MongoDB 4.2
- sealed trait Unwind extends (AggregationFramework.this)#PipelineOperator
- final class UnwindField extends (AggregationFramework.this)#Unwind
Turns a document with an array into multiple documents, one document for each element in the array.
Turns a document with an array into multiple documents, one document for each element in the array. http://docs.mongodb.org/manual/reference/aggregation/unwind/#_S_unwind
- final class ChangeStream extends AggregationFramework.PipelineOperator
Low level pipeline operator which allows to open a tailable cursor against subsequent change events of a given collection.
Low level pipeline operator which allows to open a tailable cursor against subsequent change events of a given collection.
For common use-cases, you might prefer to use the
watch
operator on a collection.Note: the target mongo instance MUST be a replica-set (even in the case of a single node deployement).
- Definition Classes
- ChangeStreamAggregation
- Since
MongoDB 3.6
Abstract Value Members
- abstract val pack: P
- Definition Classes
- AggregationPipeline
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from AggregationFramework[P] toany2stringadd[AggregationFramework[P]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (AggregationFramework[P], B)
- Implicit
- This member is added by an implicit conversion from AggregationFramework[P] toArrowAssoc[AggregationFramework[P]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final lazy val builder: Builder[(AggregationFramework.this)#pack.type]
- Attributes
- protected
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def ensuring(cond: (AggregationFramework[P]) => Boolean, msg: => Any): AggregationFramework[P]
- Implicit
- This member is added by an implicit conversion from AggregationFramework[P] toEnsuring[AggregationFramework[P]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (AggregationFramework[P]) => Boolean): AggregationFramework[P]
- Implicit
- This member is added by an implicit conversion from AggregationFramework[P] toEnsuring[AggregationFramework[P]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): AggregationFramework[P]
- Implicit
- This member is added by an implicit conversion from AggregationFramework[P] toEnsuring[AggregationFramework[P]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): AggregationFramework[P]
- Implicit
- This member is added by an implicit conversion from AggregationFramework[P] toEnsuring[AggregationFramework[P]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def pipe(name: String, arg: P.Value): P.Document
- Attributes
- protected
- Annotations
- @inline()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object AddFieldToSet
- Definition Classes
- GroupAggregation
- object AddFields
$addFields stage .
$addFields stage .
- Since
MongoDB 3.4
- object AddToSet
- Definition Classes
- GroupAggregation
- object Ascending
- Definition Classes
- SortAggregation
- object AtlasSearch
EXPERIMENTAL: Atlas Search (only on MongoDB Atlas)
EXPERIMENTAL: Atlas Search (only on MongoDB Atlas)
- Definition Classes
- AtlasSearchAggregation
- object Avg
- Definition Classes
- GroupAggregation
- object AvgField
- Definition Classes
- GroupAggregation
- object Bucket
$bucket aggregation stage .
- object BucketAuto
$bucket aggregation stage .
$bucket aggregation stage .
- Since
MongoDB 3.4 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. Document fields identifier must be prefixed with
$
.
- object CollStats
$collStats aggregation stage .
- object Count
$count of the number of documents input
$count of the number of documents input
- Since
MongoDB 3.4
- object CurrentOp
- Since
MongoDB 3.6
- object Descending
- Definition Classes
- SortAggregation
- object Facet
Performs $facet stage, to process multiple aggregation pipelines within a single stage on the same set of input documents.
Performs $facet stage, to process multiple aggregation pipelines within a single stage on the same set of input documents.
Each sub-pipeline has its own field in the output document where its results are stored as an array of documents.
- object Filter
Filter companion
- object First
- Definition Classes
- GroupAggregation
- object FirstField
- Definition Classes
- GroupAggregation
- object GeoNear
- object GraphLookup
- object Group
$groups documents together to calculate aggregates on document collections .
$groups documents together to calculate aggregates on document collections .
This command aggregates on arbitrary identifiers. Document fields identifier must be prefixed with
$
. - object GroupField
- object GroupFunction
Factory to declare custom call to a group function.
Factory to declare custom call to a group function.
- Definition Classes
- GroupAggregation
- object GroupMulti
- case object IndexStats extends (AggregationFramework.this)#PipelineOperator with Product with Serializable
$indexStats aggregation stage.
$indexStats aggregation stage.
- Since
MongoDB 3.2
- object IndexStatsResult
- object Last
- Definition Classes
- GroupAggregation
- object LastField
- Definition Classes
- GroupAggregation
- object Limit
- object ListLocalSessions
- object ListSessions
- object Lookup
Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing .
Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing .
- Since
MongoDB 3.2
- See also
- object LookupPipeline
Performs an uncorrelated lookup .
Performs an uncorrelated lookup .
- Since
MongoDB 3.6
- See also
- object Match
Filters out documents from the stream that do not match the predicate.
- object Max
- Definition Classes
- GroupAggregation
- object MaxField
- Definition Classes
- GroupAggregation
- object Merge
- object MergeObjects
- Definition Classes
- GroupAggregation
- object MetadataSort
- Definition Classes
- SortAggregation
- object Min
- Definition Classes
- GroupAggregation
- object MinField
- Definition Classes
- GroupAggregation
- object Out
- 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 reactivemongo.api.bson.BSONDocument import reactivemongo.api.bson.collection.BSONCollection def foo(coll: BSONCollection) = coll.aggregateWith[BSONDocument]() { agg => import agg.PipelineOperator List(PipelineOperator(BSONDocument( f"$$sample" -> BSONDocument("size" -> 2)))) }
- Definition Classes
- AggregationPipeline
- case object PlanCacheStats extends (AggregationFramework.this)#PipelineOperator with Product with Serializable
$planCacheStats aggregation stage.
$planCacheStats aggregation stage.
- Since
MongoDB 4.2
- object Project
- object Push
- Definition Classes
- GroupAggregation
- object PushField
- Definition Classes
- GroupAggregation
- object Redact
- object ReplaceRoot
- object ReplaceRootField
- object ReplaceWith
- object Sample
- object SearchString
EXPERIMENTAL: Search string utilities
EXPERIMENTAL: Search string utilities
- Definition Classes
- AtlasSearchAggregation
- See also
https://docs.atlas.mongodb.com/reference/atlas-search/path-construction/#usage
- object Set
- object Skip
- object Slice
import reactivemongo.api.bson.{ BSONDocument, BSONInteger, BSONString } import reactivemongo.api.bson.collection.BSONCollection def foo(coll: BSONCollection) = coll.aggregateWith[BSONDocument]() { agg => import agg.{ Project, Slice } // Define the pipeline stages List(Project(BSONDocument( "name" -> 1, "favorites" -> Slice( array = BSONString(f"$$favorites"), n = BSONInteger(3))))) }
- Definition Classes
- SliceAggregation
- object Sort
- object SortByCount
- object SortByFieldCount
- object StdDevPop
- Definition Classes
- GroupAggregation
- object StdDevPopField
- Definition Classes
- GroupAggregation
- object StdDevSamp
- Definition Classes
- GroupAggregation
- object StdDevSampField
- Definition Classes
- GroupAggregation
- object Sum
- Definition Classes
- GroupAggregation
- case object SumAll extends GroupFunction with Product with Serializable
The
$sum: 1
group accumulator.The
$sum: 1
group accumulator.- Definition Classes
- GroupAggregation
- object SumField
- Definition Classes
- GroupAggregation
- case 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
- object Unset
- object Unwind
- object UnwindField
- object ChangeStream
- Definition Classes
- ChangeStreamAggregation
Deprecated Value Members
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from AggregationFramework[P] toStringFormat[AggregationFramework[P]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (AggregationFramework[P], B)
- Implicit
- This member is added by an implicit conversion from AggregationFramework[P] toArrowAssoc[AggregationFramework[P]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.