The $addToSet group accumulator.
The $addToSet group accumulator.
$addFields stage (since MongoDB 3.4)
$addFields stage (since MongoDB 3.4)
The fields to include. The resulting objects will also contain these fields.
The $addToSet group accumulator.
The $addToSet group accumulator.
Ascending sort order
Ascending sort order
The $avg group accumulator.
The $avg group accumulator.
The $avg group accumulator.
The $avg group accumulator.
$bucket aggregation stage.
$bucket aggregation stage (since MongoDB 3.4).
$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 $
.
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).
$collStats aggregation stage.
$count of the number of documents input (since MongoDB 3.4).
$count of the number of documents input (since MongoDB 3.4).
the name of the output field which has the count as its value
$currentOp (since MongoDB 3.6).
$currentOp (since MongoDB 3.6).
(Defaults to false
)
if set to true, all operations including idle connections will be returned (Defaults to false
)
(Defaults to false
; new in 4.2)
(Defaults to true
; new in 4.0)
(Defaults to false; new in 4.0)
Descending sort order
Descending sort order
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.
the subpipelines to run
https://docs.mongodb.com/manual/reference/operator/aggregation/facet/
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.
The $graphLookup aggregation stage (since MongoDB 3.4)
The $graphLookup aggregation stage (since MongoDB 3.4)
the target collection for the $graphLookup operation to search
the expression that specifies the value of the connectFromField
with which to start the recursive search
the field name whose value $graphLookup
uses to recursively match against the connectToField
of other documents in the collection
the field name in other documents against which to match the value of the field specified by the connectFromField
parameter
the name of the array field added to each output document
an optional non-negative integral number specifying the maximum recursion depth
an optional name for a field to add to each traversed document in the search path
an optional filter expression
$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 $
.
any BSON value acceptable by mongodb as identifier
the sequence of operators specifying aggregate calculation
$groups documents together to calculate aggregates on document collections.
$groups documents together to calculate aggregates on document collections. This command aggregates on one field.
the name of the field to aggregate on
the sequence of operators specifying aggregate calculation
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 fields to aggregate on, and the names they should be aggregated under.
the sequence of operators specifying aggregate calculation
the number of operations that used the index
the time from which MongoDB gathered the statistics
the index name
the key specification
the hostname and port of the mongod
the index statistics
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.
the number of documents to allow through
$listLocalSessions aggregation stage (since MongoDB 3.6)
$listSessions aggregation stage (since MongoDB 3.6)
_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
the collection to perform the join with
the field from the documents input
the field from the documents in the from
collection
the name of the new array field to add to the input documents
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 query that documents must satisfy to be in the stream
The $max group accumulator.
The $max group accumulator.
The $max group accumulator.
The $max group accumulator.
$merge aggregation stage (since MongoDB 4.2)
$merge aggregation stage (since MongoDB 4.2)
the name of the into
database
the name of the into
collection
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
the name of the output 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 fields to include. The resulting objects will contain only these fields.
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
the redact expression
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 new root object
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 field name to become the new root
The $replaceWith aggregation stage (Since 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.
the number of documents to return
$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.
the number of documents to skip
Returns a subset of an array.
Returns a subset of an array. https://docs.mongodb.com/manual/reference/operator/aggregation/slice/
$sorts the stream based on the given fields.
$sorts the stream based on the given fields.
the fields to sort by
The $sortByCount aggregation stage (Since MongoDB 3.4)
The $sortByCount aggregation stage (Since MongoDB 3.4)
The $sortByCount aggregation stage (Since MongoDB 3.4)
the field name
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 (since MongoDB 3.2)
The $stdDevPop group accumulator (since MongoDB 3.2)
The $stdDevPop for a single field (since MongoDB 3.2)
The $stdDevPop for a single field (since MongoDB 3.2)
The $stdDevSamp group accumulator (since MongoDB 3.2)
The $stdDevSamp group accumulator (since MongoDB 3.2)
The $stdDevSamp for a single field (since MongoDB 3.2)
The $stdDevSamp for a single field (since MongoDB 3.2)
The $sum group accumulator.
The $sum group accumulator.
The $sum group accumulator.
The $sum group accumulator.
The $unset aggregation stage (Since MongoDB 4.2)
The $unset aggregation stage (Since MongoDB 4.2)
the field name
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
the name of the array to unwind
the sequence of MongoDB aggregation operations
specifies to return the information on the processing of the pipeline
enables writing to temporary files
the cursor object for aggregation
available only if you specify the $out aggregation operator
the read concern (since MongoDB 3.2)
(Since version 0.12.7) Use api.collections.Aggregator
the documents of the first batch
the cursor from the result, if any
(Since version 0.12.7) Use api.collections.Aggregator
the initial batch size for the cursor
(Since version 0.12.7) Use api.collections.Aggregator
The $filter aggregation stage.
The $filter aggregation stage.
the expression that resolves to an array
The variable name for the element in the input array. The as expression accesses each element in the input array by this variable.
the expression that determines whether to include the element in the resulting array
(Since version 0.19.4) Not a pipeline operator (stage)
(Since version 0.12.0) Use SumAll
Filter companion
Factory to declare custom call to a group function.
Factory to declare custom call to a group function.
$indexStats aggregation stage (Since MongoDB 3.2)
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 }
$planCacheStats aggregation stage (since MongoDB 4.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.{ Project, Slice } // Define the pipeline stages Project(BSONDocument( "name" -> 1, "favorites" -> Slice( array = BSONString(f"$$favorites"), n = BSONInteger(3)).makePipe)) -> List.empty } }
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.
Implements the Aggregation Framework.
PipelineOperator