AggregationFramework
Implements the Aggregation Framework.
Attributes
- See also:
PipelineOperator
- Graph
- Supertypes
- Known subtypes
- object AggregationFramework.type
- Self type
- PackSupport[P]
Members list
Type members
Classlikes
$addFields stage .
$addFields stage .
$addFields stage .
Attributes
$bucket aggregation stage .
$bucket aggregation stage .
Attributes
- 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
$
.- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- BucketAuto.type
$collStats aggregation stage .
$collStats aggregation stage .
$collStats aggregation stage .
Attributes
Attributes
- Companion:
- object
- Graph
- Supertypes
Attributes
Attributes
- batchSize
the initial batch size for the cursor
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
$documents stage
$documents stage
$documents stage
Attributes
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.
Attributes
The $filter aggregation stage.
The $filter aggregation stage.
Attributes
- 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
- input
the expression that resolves to an array
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
$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.
Attributes
- distanceField
the output field that contains the calculated distance
- distanceMultiplier
the factor to multiply all distances returned by the query
- includeLocs
this specifies the output field that identifies the location used to calculate the distance
- limit
the maximum number of documents to return (no longer supported since MongoDB 4.2)
- maxDistance
the maximum distance from the center point that the documents can be
- near
the point for which to find the closest documents
- query
limits the results to the matching documents
- spherical
if using a 2dsphere index
- uniqueDocs
if this value is true, the query returns a matching document once
- Companion:
- object
- Graph
- Supertypes
The $graphLookup aggregation stage.
The $graphLookup aggregation stage.
Attributes
- as
the name of the array field added to each output document
- 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- depthField
an optional name for a field to add to each traversed document in the search path
- from
the target collection for the $graphLookup operation to search
- maxDepth
an optional non-negative integral number specifying the maximum recursion depth
- restrictSearchWithMatch
an optional filter expression
- startWith
the expression that specifies the value of the
connectFromField
with which to start the recursive search- Since:
MongoDB 3.4
- Companion:
- object
- Graph
- Supertypes
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- GraphLookup.type
$groups documents together to calculate aggregates on document collections. This command aggregates on one field.
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- GroupField.type
$groups documents together to calculate aggregates on document collections. This command aggregates on multiple fields, and they must be named.
$groups documents together to calculate aggregates on document collections. This command aggregates on multiple fields, and they must be named.
Attributes
- idFields
The fields to aggregate on, and the names they should be aggregated under.
- ops
the sequence of operators specifying aggregate calculation
- Companion:
- object
- Graph
- Supertypes
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- GroupMulti.type
Attributes
- ops
the number of operations that used the index
- since
the time from which MongoDB gathered the statistics
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
$indexStats aggregation stage.
$indexStats aggregation stage.
Attributes
- Since:
MongoDB 3.2
- Graph
- Supertypes
- trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait PipelineOperatorclass Objecttrait Matchableclass Any
- Self type
- IndexStats.type
Attributes
- accesses
the index statistics
- host
the hostname and port of the mongod
- key
the key specification
- name
the index name
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- IndexStatsResult.type
$listLocalSessions aggregation stage.
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ListLocalSessions.type
$listSessions aggregation stage.
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ListSessions.type
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 .
Attributes
- See also:
- Companion:
- object
- Graph
- Supertypes
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 .
Attributes
Performs an uncorrelated lookup .
Performs an uncorrelated lookup .
Performs an uncorrelated lookup .
Attributes
- See also:
- Since:
MongoDB 3.6
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- LookupPipeline.type
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
Attributes
- collection
the name of the output collection
- Companion:
- object
- Graph
- Supertypes
$planCacheStats aggregation stage.
$planCacheStats aggregation stage.
Attributes
- Since:
MongoDB 4.2
- Graph
- Supertypes
- trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait PipelineOperatorclass Objecttrait Matchableclass Any
- Self type
- PlanCacheStats.type
Reshapes a document stream by renaming, adding, or removing fields. Also uses Project to create computed values or sub-objects.
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
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
Attributes
- expression
the redact expression
- Companion:
- object
- Graph
- Supertypes
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. The operation replaces all existing fields in the input document, including the _id field. https://docs.mongodb.com/manual/reference/operator/aggregation/replaceRoot
Attributes
- newRoot
The new root object
- Companion:
- object
- Graph
- Supertypes
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ReplaceRoot.type
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. The operation replaces all existing fields in the input document, including the _id field. https://docs.mongodb.com/manual/reference/operator/aggregation/replaceRoot
Attributes
- newRoot
The field name to become the new root
- Companion:
- object
- Graph
- Supertypes
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ReplaceRootField.type
The $replaceWith aggregation stage.
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ReplaceWith.type
The $sortByCount aggregation stage.
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- SortByCount.type
The $sortByCount aggregation stage.
The $sortByCount aggregation stage.
Attributes
- field
the field name
- Since:
MongoDB 3.4
- Companion:
- object
- Graph
- Supertypes
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- SortByFieldCount.type
$unionWith stage
$unionWith stage
Attributes
- collection
the name of the collection
- pipeline
the union pipeline
- Companion:
- object
- Graph
- Supertypes
$unionWith stage
$unionWith stage
Attributes
Attributes
- Companion:
- object
- Graph
- Supertypes
- Known subtypes
- class UnwindField
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
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
Attributes
- field
the name of the array to unwind
- Companion:
- object
- Graph
- Supertypes
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- UnwindField.type
Inherited classlikes
The $addToSet group accumulator.
The $addToSet group accumulator.
Attributes
- field
the name of field to group
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $addToSet group accumulator.
The $addToSet group accumulator.
Attributes
- addToSetExpr
the
$addToSet
expression- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Ascending sort order
Attributes
- Inherited from:
- SortAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
'''EXPERIMENTAL:''' See AtlasSearch$
'''EXPERIMENTAL:''' See AtlasSearch$
Attributes
- index
the index name (optional)
- Inherited from:
- AtlasSearchAggregation (hidden)
- Graph
- Supertypes
'''EXPERIMENTAL:''' Atlas Search (only on MongoDB Atlas)
'''EXPERIMENTAL:''' Atlas Search (only on MongoDB Atlas)
Attributes
- Inherited from:
- AtlasSearchAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $avg group accumulator.
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $avg group accumulator.
The $avg group accumulator.
Attributes
- field
the name of field to group
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
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).
Attributes
- Since:
MongoDB 3.6
- Inherited from:
- ChangeStreamAggregation
- Graph
- Supertypes
Attributes
- Inherited from:
- ChangeStreamAggregation
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Descending sort order
Attributes
- Inherited from:
- SortAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $field group accumulator.
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $field group accumulator.
The $field group accumulator.
Attributes
- field
the name of field to group
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Factory to declare custom call to a group function.
Factory to declare custom call to a group function.
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Represents one of the group/accumulator operators,
for the $group
aggregation. Operation.
Represents one of the group/accumulator operators,
for the $group
aggregation. Operation.
Attributes
- See also:
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- class AddFieldToSetclass AddToSetclass Avgclass AvgFieldclass Firstclass FirstFieldclass Lastclass LastFieldclass Maxclass MaxFieldclass MergeObjectsclass Minclass MinFieldclass Pushclass PushFieldclass StdDevPopclass StdDevPopFieldclass StdDevSampclass StdDevSampFieldclass Sumobject SumAll.typeclass SumFieldclass SumValue
The $field group accumulator.
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $field group accumulator.
The $field group accumulator.
Attributes
- field
the name of field to group
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $max group accumulator.
The $max group accumulator.
Attributes
- maxExpr
the
$max
expression- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $max group accumulator.
The $max group accumulator.
Attributes
- field
the name of field to group
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $mergeObjects group accumulator.
The $mergeObjects group accumulator.
Attributes
- mergeExpr
the
$mergeObjects
expression- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- SortAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object TextScore.type
Metadata sort order.
Metadata sort order.
Attributes
- keyword
the metadata keyword to sort by
- Inherited from:
- SortAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- SortAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $min group accumulator.
The $min group accumulator.
Attributes
- minExpr
the
$min
expression- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $min group accumulator.
The $min group accumulator.
Attributes
- field
the name of field to group
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
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))))
}
Attributes
- Inherited from:
- AggregationPipeline (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
One of MongoDBs pipeline operators for aggregation. Sealed as these are defined in the MongoDB specifications, and clients should not have custom operators.
One of MongoDBs pipeline operators for aggregation. Sealed as these are defined in the MongoDB specifications, and clients should not have custom operators.
Attributes
- Inherited from:
- AggregationPipeline (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- class AddFieldsclass AtlasSearchclass Bucketclass BucketAutoclass ChangeStreamclass CollStatsclass Countclass CurrentOpclass Documentsclass Facetclass GeoNearclass GraphLookupclass Groupclass GroupFieldclass GroupMultiobject IndexStats.typeclass Limitclass ListLocalSessionsclass ListSessionsclass Lookupclass LookupPipelineclass Matchclass Mergeclass Outobject PlanCacheStats.typeclass Projectclass Redactclass ReplaceRootclass ReplaceRootFieldclass ReplaceWithclass Sampleclass Setclass Skipclass Sliceclass Sortclass SortByCountclass SortByFieldCountclass UnionWithclass Unsettrait Unwindclass UnwindField
The $push group accumulator.
The $push group accumulator.
Attributes
- pushExpr
the
$push
expression- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $push group accumulator.
The $push group accumulator.
Attributes
- field
the name of field to group
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
'''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
Attributes
- Inherited from:
- AtlasSearchAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
'''EXPERIMENTAL:''' Search string utilities
'''EXPERIMENTAL:''' Search string utilities
Attributes
- See also:
- Inherited from:
- AtlasSearchAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Returns a slice/subset of an array.
Returns a slice/subset of an array.
Attributes
- array
any valid expression that resolves to an array
- n
any valud expression that resolves to an integer
- position
any valid expression that resolves to an integer
- Inherited from:
- SliceAggregation (hidden)
- Graph
- Supertypes
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)))))
}
Attributes
- Inherited from:
- SliceAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
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.
Attributes
- Inherited from:
- SortAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
The $stdDevPop group accumulator.
The $stdDevPop group accumulator.
Attributes
- Since:
MongoDB 3.2
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $stdDevPop for a single field.
The $stdDevPop for a single field.
Attributes
- field
the name of field to group
- Since:
MongoDB 3.2
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $stdDevSamp group accumulator
The $stdDevSamp group accumulator
Attributes
- Since:
MongoDB 3.2
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $stdDevSamp for a single field
The $stdDevSamp for a single field
Attributes
- field
the name of field to group
- Since:
MongoDB 3.2
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The $sum group accumulator.
The $sum group accumulator.
Attributes
- sumExpr
the
$sum
expression- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
The `$sum: 1` group accumulator.
The `$sum: 1` group accumulator.
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait GroupFunctionclass Objecttrait Matchableclass Any
The $sum group accumulator.
The $sum group accumulator.
Attributes
- field
the name of field to group
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- GroupAggregation (hidden)
- Graph
- Supertypes
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.
Attributes
- Inherited from:
- SortAggregation (hidden)
- Graph
- Supertypes
- trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait MetadataKeywordclass Objecttrait Matchableclass Any
Inherited types
Aggregation pipeline (with at least one stage operator)
Aggregation pipeline (with at least one stage operator)
Attributes
- Inherited from:
- AggregationPipeline (hidden)