trait AggregationFramework[P <: SerializationPack] extends ImplicitCommandHelpers[P] with GroupAggregation[P] with SliceAggregation[P] with AggregationPipeline[P]
- Alphabetic
- By Inheritance
- AggregationFramework
- AggregationPipeline
- SliceAggregation
- GroupAggregation
- ImplicitCommandHelpers
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Type Members
- case class AddFieldToSet extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class AddFields extends PipelineOperator with Product with Serializable
Since MongoDB 3.4
Since MongoDB 3.4
- Definition Classes
- GroupAggregation
- See also
https://docs.mongodb.com/manual/reference/operator/aggregation/addFields/
- case class AddToSet extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class Ascending(field: String) extends SortOrder with Product with Serializable
Ascending sort order
- case class Avg extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class AvgField extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class BucketAuto(groupBy: P.Value, buckets: Int, granularity: Option[String])(output: (String, AggregationFramework.GroupFunction)*) extends PipelineOperator with Product with Serializable
Since MongoDB 3.4 Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression.
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
$
. https://docs.mongodb.com/manual/reference/operator/aggregation/bucketAuto/ - final class ChangeStream extends PipelineOperator
Low level pipeline operator which allows to open a tailable cursor against subsequent ChangeEvents of a given collection (since MongoDB 3.6).
Low level pipeline operator which allows to open a tailable cursor against subsequent ChangeEvents of a given collection (since MongoDB 3.6). https://docs.mongodb.com/manual/reference/change-events/
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).
- case class Count(outputName: String) extends PipelineOperator with Product with Serializable
_Since MongoDB 3.4:_ Counts of the number of documents input.
_Since MongoDB 3.4:_ Counts of the number of documents input. https://docs.mongodb.com/manual/reference/operator/aggregation/count/
- outputName
the name of the output field which has the count as its value
- case class Descending(field: String) extends SortOrder with Product with Serializable
Descending sort order
- case class Facet(specifications: Iterable[(String, AggregationFramework.Pipeline)]) extends PipelineOperator with Product with Serializable
Processes multiple aggregation pipelines within a single stage on the same set of input documents.
Processes 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.
- specifications
the subpipelines to run
- See also
https://docs.mongodb.com/manual/reference/operator/aggregation/facet/
- case class Filter(input: P.Value, as: String, cond: P.Document) extends PipelineOperator with Product with Serializable
The $filter aggregation stage.
The $filter aggregation stage.
- input
the expression that resolves to an array
- as
The variable name for the element in the input array. The as expression accesses each element in the input array by this variable.
- cond
the expression that determines whether to include the element in the resulting array
- case class First extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class FirstField extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- class GeoNear extends PipelineOperator with Product with Serializable
Outputs documents in order of nearest to farthest from a specified point.
Outputs documents in order of nearest to farthest from a specified point.
http://docs.mongodb.org/manual/reference/operator/aggregation/geoNear/#pipe._S_geoNear
- case class GraphLookup(from: String, startWith: P.Value, connectFromField: String, connectToField: String, as: String, maxDepth: Option[Int] = None, depthField: Option[String] = None, restrictSearchWithMatch: Option[P.Value] = None) extends PipelineOperator with Product with Serializable
_Since MongoDB 3.4:_ The $graphLookup aggregation stage.
_Since MongoDB 3.4:_ The $graphLookup aggregation stage.
- from
the target collection for the $graphLookup operation to search
- startWith
the expression that specifies the value of the
connectFromField
with which to start the recursive search- connectFromField
the field name whose value
$graphLookup
uses to recursively match against theconnectToField
of other documents in the collection- connectToField
the field name in other documents against which to match the value of the field specified by the
connectFromField
parameter- as
the name of the array field added to each output document
- maxDepth
an optional non-negative integral number specifying the maximum recursion depth
- depthField
an optional name for a field to add to each traversed document in the search path
- restrictSearchWithMatch
an optional filter expression
- 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.
Groups documents together to calculate aggregates on document collections. This command aggregates on arbitrary identifiers. Document fields identifier must be prefixed with
$
. http://docs.mongodb.org/manual/reference/aggregation/group/#_S_group- identifiers
any BSON value acceptable by mongodb as identifier
- ops
the sequence of operators specifying aggregate calculation
- case class GroupField(idField: String)(ops: (String, AggregationFramework.GroupFunction)*) extends PipelineOperator with Product with Serializable
Groups documents together to calculate aggregates on document collections.
Groups documents together to calculate aggregates on document collections. This command aggregates on one field. http://docs.mongodb.org/manual/reference/aggregation/group/#_S_group
- idField
the name of the field to aggregate on
- ops
the sequence of operators specifying aggregate calculation
- 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
- 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.
Groups documents together to calculate aggregates on document collections. This command aggregates on multiple fields, and they must be named. http://docs.mongodb.org/manual/reference/aggregation/group/#_S_group
- idFields
The fields to aggregate on, and the names they should be aggregated under.
- ops
the sequence of operators specifying aggregate calculation
- case class IndexStatAccesses(ops: Long, since: Long) extends Product with Serializable
- ops
the number of operations that used the index
- since
the time from which MongoDB gathered the statistics
- case class IndexStatsResult(name: String, key: P.Document, host: String, accesses: IndexStatAccesses) extends Product with Serializable
- name
the index name
- key
the key specification
- host
the hostname and port of the mongod
- accesses
the index statistics
- case class Last extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class LastField extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class Limit(limit: Int) extends PipelineOperator with Product with Serializable
Limits the number of documents that pass through the stream.
Limits the number of documents that pass through the stream. http://docs.mongodb.org/manual/reference/aggregation/limit/#_S_limit
- limit
the number of documents to allow through
- case class Lookup(from: String, localField: String, foreignField: String, as: String) extends PipelineOperator with Product with Serializable
_Since MongoDB 3.2:_ 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:_ Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing. https://docs.mongodb.com/v3.2/reference/operator/aggregation/lookup/#pipe._S_lookup
- from
the collection to perform the join with
- localField
the field from the documents input
- foreignField
the field from the documents in the
from
collection- as
the name of the new array field to add to the input documents
- case class Match(predicate: P.Document) extends PipelineOperator with Product with Serializable
Filters out documents from the stream that do not match the predicate.
Filters out documents from the stream that do not match the predicate. http://docs.mongodb.org/manual/reference/aggregation/match/#_S_match
- predicate
the query that documents must satisfy to be in the stream
- case class Max extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class MaxField extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- sealed trait MetadataKeyword extends AnyRef
- case class MetadataSort(field: String, keyword: MetadataKeyword) extends SortOrder with Product with Serializable
Metadata sort order.
Metadata sort order.
- keyword
the metadata keyword to sort by
- case class Min extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class MinField extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- 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 http://docs.mongodb.org/manual/reference/operator/aggregation/out/#pipe._S_out
Takes the documents returned by the aggregation pipeline and writes them to a specified collection http://docs.mongodb.org/manual/reference/operator/aggregation/out/#pipe._S_out
- collection
the name of the output collection
- type Pipeline = (PipelineOperator, List[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
- case class Project(specifications: P.Document) extends PipelineOperator with Product with Serializable
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.
- specifications
The fields to include. The resulting objects will contain only these fields.
- case class Push extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class PushField extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- 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.
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
- expression
the redact expression
- 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.
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
- newRoot
The new root object
- case class ReplaceRootField(newRoot: String) extends PipelineOperator with Product with Serializable
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
- newRoot
The field name to become the new root
- case class Sample(size: Int) extends PipelineOperator with Product with Serializable
Randomly selects the specified number of documents from its input.
Randomly selects the specified number of documents from its input. https://docs.mongodb.org/master/reference/operator/aggregation/sample/
- size
the number of documents to return
- 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.
Skips over a number of documents before passing all further documents along the stream. http://docs.mongodb.org/manual/reference/aggregation/skip/#_S_skip
- skip
the number of documents to skip
- 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
- case class Sort(fields: SortOrder*) extends PipelineOperator with Product with Serializable
Sorts the stream based on the given fields.
Sorts the stream based on the given fields. http://docs.mongodb.org/manual/reference/aggregation/sort/#_S_sort
- fields
the fields to sort by
- sealed trait SortOrder extends AnyRef
Represents that a field should be sorted on, as well as whether it should be ascending or descending.
- case class StdDevPop extends GroupFunction with Product with Serializable
The $stdDevPop group accumulator (since MongoDB 3.2)
The $stdDevPop group accumulator (since MongoDB 3.2)
- Definition Classes
- GroupAggregation
- case class StdDevPopField extends GroupFunction with Product with Serializable
The $stdDevPop for a single field (since MongoDB 3.2)
The $stdDevPop for a single field (since MongoDB 3.2)
- Definition Classes
- GroupAggregation
- case class StdDevSamp extends GroupFunction with Product with Serializable
The $stdDevSamp group accumulator (since MongoDB 3.2)
The $stdDevSamp group accumulator (since MongoDB 3.2)
- Definition Classes
- GroupAggregation
- case class StdDevSampField extends GroupFunction with Product with Serializable
The $stdDevSamp for a single field (since MongoDB 3.2)
The $stdDevSamp for a single field (since MongoDB 3.2)
- Definition Classes
- GroupAggregation
- case class Sum extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- case class SumField extends GroupFunction with Product with Serializable
- Definition Classes
- GroupAggregation
- class Unwind extends PipelineOperator with Product with Serializable
- 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.
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
- field
the name of the array to unwind
- trait ImplicitlyDocumentProducer extends AnyRef
- Definition Classes
- ImplicitCommandHelpers
Deprecated Type Members
- 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
- pipeline
the sequence of MongoDB aggregation operations
- explain
specifies to return the information on the processing of the pipeline
- allowDiskUse
enables writing to temporary files
- cursor
the cursor object for aggregation
- bypassDocumentValidation
available only if you specify the $out aggregation operator
- readConcern
the read concern (since MongoDB 3.2)
- Annotations
- @deprecated
- Deprecated
(Since version 0.12.7) Use
api.collections.Aggregator
- case class AggregationResult(firstBatch: List[P.Document], cursor: Option[ResultCursor] = None) extends Product with Serializable
- firstBatch
the documents of the first batch
- cursor
the cursor from the result, if any
- Annotations
- @deprecated
- Deprecated
(Since version 0.12.7) Use
api.collections.Aggregator
- See also
- case class Cursor(batchSize: Int) extends Product with Serializable
- batchSize
the initial batch size for the cursor
- Annotations
- @deprecated
- Deprecated
(Since version 0.12.7) Use
api.collections.Aggregator
- 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
- 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
- lazy val builder: Builder[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])
- 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
- @inline()
- 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 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 Filter extends Serializable
Filter companion
- object GeoNear extends Serializable
- object GroupFunction
Factory to declare custom call to a group function.
Factory to declare custom call to a group function.
- Definition Classes
- GroupAggregation
- object IndexStats extends PipelineOperator with Product with Serializable
Since MongoDB 3.2 https://docs.mongodb.com/manual/reference/operator/aggregation/indexStats/
- 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
- 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
- object SumAll extends GroupFunction with Product with Serializable
Sum operation of the form
$sum: 1
Sum operation of the form
$sum: 1
- Definition Classes
- GroupAggregation
- object TextScore extends MetadataKeyword with Product with Serializable
References the score associated with the corresponding
$text
query for each matching document. - object Unwind extends Serializable
- object ImplicitlyDocumentProducer
- Definition Classes
- ImplicitCommandHelpers
Deprecated Value Members
- 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.