reactivemongo.api.collections.AggregationOps
The $addToSet group accumulator.
The $addToSet group accumulator.
$addFields stage .
$addFields stage .
The $addToSet group accumulator.
The $addToSet group accumulator.
Ascending sort order
Ascending sort order
EXPERIMENTAL: See AtlasSearch$
EXPERIMENTAL: See AtlasSearch$
The $avg group accumulator.
The $avg group accumulator.
The $avg group accumulator.
The $avg group accumulator.
$bucket aggregation stage .
$bucket aggregation stage .
$bucket aggregation stage .
$bucket aggregation stage .
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).
MongoDB 3.6
$collStats aggregation stage .
$collStats aggregation stage .
$count of the number of documents input .
$count of the number of documents input .
Descending sort order
Descending sort order
$facet .
$facet .
The $filter aggregation stage.
The $filter aggregation stage.
The $field group accumulator.
The $field group accumulator.
The $field group accumulator.
The $field group accumulator.
$geoNear aggregation stage, that outputs documents in order of nearest to farthest from a specified point.
$geoNear aggregation stage, that outputs documents in order of nearest to farthest from a specified point.
The $graphLookup aggregation stage.
The $graphLookup aggregation stage.
MongoDB 3.4
$groups documents together to calculate aggregates on document collections .
$groups documents together to calculate aggregates on document collections .
$groups documents together to calculate aggregates on document collections.
$groups documents together to calculate aggregates on document collections. This command aggregates on one field.
Represents one of the group/accumulator operators,
for the $group
aggregation.
Represents one of the group/accumulator operators,
for the $group
aggregation. Operation.
https://docs.mongodb.com/manual/reference/operator/aggregation/group/#accumulator-operator
$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.
The $field group accumulator.
The $field group accumulator.
The $field group accumulator.
The $field group accumulator.
$limits the number of documents that pass through the stream.
$limits the number of documents that pass through the stream.
$listLocalSessions aggregation stage.
$listLocalSessions aggregation stage.
MongoDB 3.6
$listSessions aggregation stage.
$listSessions aggregation stage.
MongoDB 3.6
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 .
Performs an uncorrelated lookup .
Performs an uncorrelated lookup .
Filters out documents from the stream that do not match the predicate.
Filters out documents from the stream that do not match the predicate.
The $max group accumulator.
The $max group accumulator.
The $max group accumulator.
The $max group accumulator.
$merge aggregation stage.
$merge aggregation stage.
MongoDB 4.2
The $mergeObjects group accumulator.
The $mergeObjects group accumulator.
Metadata sort order.
Metadata sort order.
The $min group accumulator.
The $min group accumulator.
The $min group accumulator.
The $min group accumulator.
Takes the documents returned by the aggregation pipeline and writes them to a specified collection
Takes the documents returned by the aggregation pipeline and writes them to a specified collection
Aggregation pipeline (with at least one stage operator)
Aggregation pipeline (with at least one stage operator)
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.
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.
The $push group accumulator.
The $push group accumulator.
The $push group accumulator.
The $push group accumulator.
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
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
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
The $replaceWith aggregation stage.
The $replaceWith aggregation stage.
MongoDB 4.2
$sample aggregation stage, that randomly selects the specified number of documents from its input.
$sample aggregation stage, that randomly selects the specified number of documents from its input.
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
$set aggregation stage
$set aggregation stage
$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.
Returns a slice/subset of an array.
Returns a slice/subset of an array.
$sorts the stream based on the given fields.
$sorts the stream based on the given fields.
The $sortByCount aggregation stage.
The $sortByCount aggregation stage.
MongoDB 3.4
The $sortByCount aggregation stage.
The $sortByCount aggregation stage.
MongoDB 3.4
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.
The $stdDevPop group accumulator.
The $stdDevPop group accumulator.
MongoDB 3.2
The $stdDevPop for a single field.
The $stdDevPop for a single field.
MongoDB 3.2
The $stdDevSamp group accumulator
The $stdDevSamp group accumulator
MongoDB 3.2
The $stdDevSamp for a single field
The $stdDevSamp for a single field
MongoDB 3.2
The $sum group accumulator.
The $sum group accumulator.
The $sum group accumulator.
The $sum group accumulator.
The $unset aggregation stage.
The $unset aggregation stage.
MongoDB 4.2
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
$addFields stage .
$addFields stage .
MongoDB 3.4
EXPERIMENTAL: Atlas Search (only on MongoDB Atlas)
EXPERIMENTAL: Atlas Search (only on MongoDB Atlas)
$bucket aggregation stage .
$bucket aggregation stage .
$bucket aggregation stage .
$bucket aggregation stage .
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 $
.
$collStats aggregation stage .
$collStats aggregation stage .
$count of the number of documents input
$count of the number of documents input
MongoDB 3.4
MongoDB 3.6
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.
Filter companion
Filter companion
$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 $
.
Factory to declare custom call to a group function.
Factory to declare custom call to a group function.
$indexStats aggregation stage.
$indexStats aggregation stage.
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 .
Performs a left outer join to an unsharded collection in the same database to filter in documents from the "joined" collection for processing .
MongoDB 3.2
Performs an uncorrelated lookup .
Performs an uncorrelated lookup .
MongoDB 3.6
Filters out documents from the stream that do not match the predicate.
Filters out documents from the stream that do not match the predicate.
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)))) }
$planCacheStats aggregation stage.
$planCacheStats aggregation stage.
MongoDB 4.2
EXPERIMENTAL: Search string utilities
EXPERIMENTAL: Search string utilities
https://docs.atlas.mongodb.com/reference/atlas-search/path-construction/#usage
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))))) }
The $sum: 1
group accumulator.
The $sum: 1
group accumulator.
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.
The serialization pack (BSON by default).
The serialization pack (BSON by default).
Used to resolve the types of values
(by default BSONValue
, BSONDocument
, ...), and the related typeclasses
(e.g. BSONDocumentReader
...).
The aggregation framework for this collection