object Aggregates
- Alphabetic
- By Inheritance
- Aggregates
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addFields(fields: Field[_]*): Bson
Creates an
$addFieldspipeline stageCreates an
$addFieldspipeline stage- fields
the fields to add
- returns
the
$addFieldspipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
bucket[TExpression, TBoundary](groupBy: TExpression, options: BucketOptions, boundaries: TBoundary*): Bson
Creates a
$bucketpipeline stageCreates a
$bucketpipeline stage- TExpression
the groupBy expression type
- TBoundary
the boundary type
- groupBy
the criteria to group By
- options
the optional values for the
$bucketstage- boundaries
the boundaries of the buckets
- returns
the
$bucketpipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
bucket[TExpression, TBoundary](groupBy: TExpression, boundaries: TBoundary*): Bson
Creates a $bucket pipeline stage
Creates a $bucket pipeline stage
- TExpression
the groupBy expression type
- TBoundary
the boundary type
- groupBy
the criteria to group By
- boundaries
the boundaries of the buckets
- returns
the
$bucketpipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
bucketAuto[TExpression, TBoundary](groupBy: TExpression, buckets: Int, options: BucketAutoOptions): Bson
Creates a
$bucketAutopipeline stageCreates a
$bucketAutopipeline stage- TExpression
the groupBy expression type
- groupBy
the criteria to group By
- buckets
the number of the buckets
- options
the optional values for the
$bucketAutostage- returns
the
$bucketAutopipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
bucketAuto[TExpression, TBoundary](groupBy: TExpression, buckets: Int): Bson
Creates a
$bucketAutopipeline stageCreates a
$bucketAutopipeline stage- TExpression
the groupBy expression type
- groupBy
the criteria to group By
- buckets
the number of the buckets
- returns
the
$bucketAutopipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
def
count(field: String): Bson
Creates a
$countpipeline stage using the named field to store the resultCreates a
$countpipeline stage using the named field to store the result- field
the field in which to store the count
- returns
the
$countpipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
count(): Bson
Creates a
$countpipeline stage using the field name "count" to store the resultCreates a
$countpipeline stage using the field name "count" to store the result- returns
the
$countpipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
densify(field: String, range: DensifyRange, options: DensifyOptions): Bson
Creates a
$densifypipeline stage, which adds documents to a sequence of documents where certain values in thefieldare missing.Creates a
$densifypipeline stage, which adds documents to a sequence of documents where certain values in thefieldare missing.- field
The field to densify.
- range
The range.
- options
The densify options. Specifying
DensifyOptions.densifyOptionsis equivalent to callingAggregates.densify(String, DensifyRange).- returns
The requested pipeline stage.
- Since
4.7
- Note
Requires MongoDB 5.1 or greater.
- See also
-
def
densify(field: String, range: DensifyRange): Bson
Creates a
$densifypipeline stage, which adds documents to a sequence of documents where certain values in thefieldare missing.Creates a
$densifypipeline stage, which adds documents to a sequence of documents where certain values in thefieldare missing.- field
The field to densify.
- range
The range.
- returns
The requested pipeline stage.
- Since
4.7
- Note
Requires MongoDB 5.1 or greater.
- See also
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
facet(facets: Facet*): Bson
Creates a
$facetpipeline stageCreates a
$facetpipeline stage- facets
the facets to use
- returns
the new pipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
fill(options: FillOptions, output: Iterable[_ <: FillOutputField]): Bson
Creates a
$fillpipeline stage, which assigns values to fields when they are BSONNullor missing.Creates a
$fillpipeline stage, which assigns values to fields when they are BSONNullor missing.- options
The fill options.
- output
The non-empty
FillOutputFields.- returns
The requested pipeline stage.
- Since
4.7
- Note
Requires MongoDB 5.3 or greater.
- See also
-
def
fill(options: FillOptions, output: FillOutputField, moreOutput: FillOutputField*): Bson
Creates a
$fillpipeline stage, which assigns values to fields when they are BSONNullor missing.Creates a
$fillpipeline stage, which assigns values to fields when they are BSONNullor missing.- options
The fill options.
- output
The
FillOutputField.- moreOutput
More
FillOutputFields.- returns
The requested pipeline stage.
- Since
4.7
- Note
Requires MongoDB 5.3 or greater.
- See also
-
def
filter(filter: Bson): Bson
Creates a
$matchpipeline stage for the specified filterCreates a
$matchpipeline stage for the specified filterA friendly alias for the
matchmethod.- filter
the filter to match against
- returns
the
$matchpipeline stage
- See also
Filters
-
def
geoNear(near: Point, distanceField: String): Bson
Creates a
$geoNearpipeline stage that outputs documents in order of nearest to farthest from a specified point.Creates a
$geoNearpipeline stage that outputs documents in order of nearest to farthest from a specified point.- near
The point for which to find the closest documents.
- distanceField
The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation.
- returns
the
$geoNearpipeline stage
- Since
4.8
- See also
-
def
geoNear(near: Point, distanceField: String, options: GeoNearOptions): Bson
Creates a
$geoNearpipeline stage that outputs documents in order of nearest to farthest from a specified point.Creates a
$geoNearpipeline stage that outputs documents in order of nearest to farthest from a specified point.- near
The point for which to find the closest documents.
- distanceField
The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation.
- options
- returns
the
$geoNearpipeline stage
- Since
4.8
- See also
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
def
graphLookup[TExpression](from: String, startWith: TExpression, connectFromField: String, connectToField: String, as: String, options: GraphLookupOptions): Bson
Creates a graphLookup pipeline stage for the specified filter
Creates a graphLookup pipeline stage for the specified filter
- TExpression
the expression type
- from
the collection to query
- startWith
the expression to start the graph lookup with
- connectFromField
the from field
- connectToField
the to field
- as
name of field in output document
- options
optional values for the graphLookup
- returns
the
$graphLookuppipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
graphLookup[TExpression](from: String, startWith: TExpression, connectFromField: String, connectToField: String, as: String): Bson
Creates a
$graphLookuppipeline stage for the specified filterCreates a
$graphLookuppipeline stage for the specified filter- TExpression
the expression type
- from
the collection to query
- startWith
the expression to start the graph lookup with
- connectFromField
the from field
- connectToField
the to field
- as
name of field in output document
- returns
the
$graphLookuppipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
group[TExpression](id: TExpression, fieldAccumulators: BsonField*): Bson
Creates a
$grouppipeline stage for the specified filterCreates a
$grouppipeline stage for the specified filter- TExpression
the expression type
- id
the id expression for the group
- fieldAccumulators
zero or more field accumulator pairs
- returns
the
$grouppipeline stage
- See also
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
limit(limit: Int): Bson
Creates a
$limitpipeline stage for the specified filterCreates a
$limitpipeline stage for the specified filter- limit
the limit
- returns
the
$limitpipeline stage
- See also
-
def
lookup[T](from: String, let: Seq[Variable[T]], pipeline: Seq[_ <: Bson], as: String): Bson
Creates a
$lookuppipeline stage, joining the current collection with the one specified in from using the given pipelineCreates a
$lookuppipeline stage, joining the current collection with the one specified in from using the given pipeline- from
the name of the collection in the same database to perform the join with.
- let
the variables to use in the pipeline field stages.
- pipeline
the pipeline to run on the joined collection.
- as
the name of the new array field to add to the input documents.
- returns
the
$lookuppipeline stage
- Since
2.3
- Note
Requires MongoDB 3.6 or greater
- See also
-
def
lookup(from: String, pipeline: Seq[_ <: Bson], as: String): Bson
Creates a
$lookuppipeline stage, joining the current collection with the one specified in from using the given pipelineCreates a
$lookuppipeline stage, joining the current collection with the one specified in from using the given pipeline- from
the name of the collection in the same database to perform the join with.
- pipeline
the pipeline to run on the joined collection.
- as
the name of the new array field to add to the input documents.
- returns
the
$lookuppipeline stage:
- Since
2.3
- Note
Requires MongoDB 3.6 or greater
- See also
-
def
lookup(from: String, localField: String, foreignField: String, as: String): Bson
Creates a
$lookuppipeline stage for the specified filterCreates a
$lookuppipeline stage for the specified filter- from
the name of the collection in the same database to perform the join with.
- localField
specifies the field from the local collection to match values against.
- foreignField
specifies the field in the from collection to match values against.
- as
the name of the new array field to add to the input documents.
- returns
the
$lookuppipeline stage
- Since
1.1
- Note
Requires MongoDB 3.2 or greater
- See also
-
def
match(filter: Bson): Bson
Creates a
$matchpipeline stage for the specified filterCreates a
$matchpipeline stage for the specified filter- filter
the filter to match
- returns
the
$matchpipeline stage
- See also
Filters
-
def
merge(namespace: MongoNamespace, mergeOptions: MergeOptions): Bson
Creates a
$mergepipeline stage that merges into the specified collection using the specified options.Creates a
$mergepipeline stage that merges into the specified collection using the specified options.- namespace
the namespace to merge into
- mergeOptions
the mergeOptions
- returns
the
$mergepipeline stage
-
def
merge(namespace: MongoNamespace): Bson
Creates a
$mergepipeline stage that merges into the specified collection using the specified options.Creates a
$mergepipeline stage that merges into the specified collection using the specified options.- namespace
the namespace to merge into
- returns
the
$mergepipeline stage
-
def
merge(collectionName: String, mergeOptions: MergeOptions): Bson
Creates a
$mergepipeline stage that merges into the specified collection using the specified options.Creates a
$mergepipeline stage that merges into the specified collection using the specified options.- collectionName
the name of the collection to merge into
- mergeOptions
the mergeOptions
- returns
the
$mergepipeline stage
-
def
merge(collectionName: String): Bson
Creates a
$mergepipeline stage that merges into the specified collection using the specified options.Creates a
$mergepipeline stage that merges into the specified collection using the specified options.- collectionName
the name of the collection to merge into
- returns
the
$mergepipeline stage
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
def
out(databaseName: String, collectionName: String): Bson
Creates a
$outpipeline stage that supports outputting to a different database.Creates a
$outpipeline stage that supports outputting to a different database.- databaseName
the database name
- collectionName
the collection name
- returns
the
$outpipeline stage
- See also
-
def
out(collectionName: String): Bson
Creates a
$outpipeline stage that writes to the collection with the specified nameCreates a
$outpipeline stage that writes to the collection with the specified name- collectionName
the collection name
- returns
the
$outpipeline stage
- See also
-
def
project(projection: Bson): Bson
Creates a
$projectpipeline stage for the specified projectionCreates a
$projectpipeline stage for the specified projection- projection
the projection
- returns
the
$projectpipeline stage
- See also
Projections
-
def
replaceRoot[TExpression](value: TExpression): Bson
Creates a
$replaceRootpipeline stageCreates a
$replaceRootpipeline stage- TExpression
the new root type
- value
the new root value
- returns
the
$replaceRootpipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
-
def
replaceWith[TExpression](value: TExpression): Bson
Creates a
$replaceRootpipeline stageCreates a
$replaceRootpipeline stageWith
$replaceWith, you can promote an embedded document to the top-level. You can also specify a new document as the replacement.The
$replaceWithis an alias for replaceRoot.- TExpression
the new root type
- value
the new root value
- returns
the
$replaceRootpipeline stage
- Since
2.7
- See also
-
def
sample(size: Int): Bson
Creates a
$samplepipeline stage with the specified sample sizeCreates a
$samplepipeline stage with the specified sample size- size
the sample size
- returns
the
$samplepipeline stage
- Since
1.1
- See also
-
def
search(collector: SearchCollector, options: SearchOptions): Bson
Creates a
$searchpipeline stage supported by MongoDB Atlas.Creates a
$searchpipeline stage supported by MongoDB Atlas. You may use the$meta: "searchScore"expression, e.g., via Projections.metaSearchScore, to extract the relevance score assigned to each found document.Filters.text(String, TextSearchOptions)is a legacy text search alternative.- collector
A search collector.
- options
Optional
$searchpipeline stage fields. SpecifyingSearchOptions.searchOptionsis equivalent to callingAggregates.search(SearchCollector).- returns
The
$searchpipeline stage.
- Since
4.7
- See also
-
def
search(collector: SearchCollector): Bson
Creates a
$searchpipeline stage supported by MongoDB Atlas.Creates a
$searchpipeline stage supported by MongoDB Atlas. You may use the$meta: "searchScore"expression, e.g., via Projections.metaSearchScore, to extract the relevance score assigned to each found document.Filters.text(String, TextSearchOptions)is a legacy text search alternative.- collector
A search collector.
- returns
The
$searchpipeline stage.
- Since
4.7
- See also
-
def
search(operator: SearchOperator, options: SearchOptions): Bson
Creates a
$searchpipeline stage supported by MongoDB Atlas.Creates a
$searchpipeline stage supported by MongoDB Atlas. You may use the$meta: "searchScore"expression, e.g., via Projections.metaSearchScore, to extract the relevance score assigned to each found document.Filters.text(String, TextSearchOptions)is a legacy text search alternative.- operator
A search operator.
- options
Optional
$searchpipeline stage fields. SpecifyingSearchOptions.searchOptionsis equivalent to callingAggregates.search(SearchOperator).- returns
The
$searchpipeline stage.
- Since
4.7
- See also
-
def
search(operator: SearchOperator): Bson
Creates a
$searchpipeline stage supported by MongoDB Atlas.Creates a
$searchpipeline stage supported by MongoDB Atlas. You may use the$meta: "searchScore"expression, e.g., via Projections.metaSearchScore, to extract the relevance score assigned to each found document.Filters.text(String, TextSearchOptions)is a legacy text search alternative.- operator
A search operator.
- returns
The
$searchpipeline stage.
- Since
4.7
- See also
-
def
searchMeta(collector: SearchCollector, options: SearchOptions): Bson
Creates a
$searchMetapipeline stage supported by MongoDB Atlas.Creates a
$searchMetapipeline stage supported by MongoDB Atlas. Unlike$search, it does not return found documents, instead it returns metadata, which in case of using the$searchstage may be extracted by using$$SEARCH_METAvariable, e.g., via Projections.computedSearchMeta.- collector
A search collector.
- options
Optional
$searchpipeline stage fields. SpecifyingSearchOptions.searchOptionsis equivalent to callingAggregates.searchMeta(SearchCollector).- returns
The
$searchMetapipeline stage.
- Since
4.7
- See also
-
def
searchMeta(collector: SearchCollector): Bson
Creates a
$searchMetapipeline stage supported by MongoDB Atlas.Creates a
$searchMetapipeline stage supported by MongoDB Atlas. Unlike$search, it does not return found documents, instead it returns metadata, which in case of using the$searchstage may be extracted by using$$SEARCH_METAvariable, e.g., via Projections.computedSearchMeta.- collector
A search collector.
- returns
The
$searchMetapipeline stage.
- Since
4.7
- See also
-
def
searchMeta(operator: SearchOperator, options: SearchOptions): Bson
Creates a
$searchMetapipeline stage supported by MongoDB Atlas.Creates a
$searchMetapipeline stage supported by MongoDB Atlas. Unlike$search, it does not return found documents, instead it returns metadata, which in case of using the$searchstage may be extracted by using$$SEARCH_METAvariable, e.g., via Projections.computedSearchMeta.- operator
A search operator.
- options
Optional
$searchpipeline stage fields. SpecifyingSearchOptions.searchOptionsis equivalent to callingAggregates.searchMeta(SearchOperator).- returns
The
$searchMetapipeline stage.
- Since
4.7
- See also
-
def
searchMeta(operator: SearchOperator): Bson
Creates a
$searchMetapipeline stage supported by MongoDB Atlas.Creates a
$searchMetapipeline stage supported by MongoDB Atlas. Unlike$search, it does not return found documents, instead it returns metadata, which in case of using the$searchstage may be extracted by using$$SEARCH_METAvariable, e.g., via Projections.computedSearchMeta.- operator
A search operator.
- returns
The
$searchMetapipeline stage.
- Since
4.7
- See also
-
def
set(fields: Field[_]*): Bson
Creates an $set pipeline stage
Creates an $set pipeline stage
- fields
the fields to add
- returns
the $set pipeline stage
- Since
4.3
- Note
Requires MongoDB 4.2 or greater
- See also
-
def
setWindowFields[TExpression >: Null](partitionBy: Option[TExpression], sortBy: Option[Bson], output: Iterable[_ <: WindowOutputField]): Bson
Creates a
$setWindowFieldspipeline stage, which allows using window operators.Creates a
$setWindowFieldspipeline stage, which allows using window operators. This stage partitions the input documents similarly to the $group pipeline stage, optionally sorts them, computes fields in the documents by computing window functions over windows specified per function, and outputs the documents. The important difference from the$grouppipeline stage is that documents belonging to the same partition or window are not folded into a single document.- TExpression
The
partitionByexpression type.- partitionBy
Optional partitioning of data specified like
idin Aggregates.group. IfNone, then all documents belong to the same partition.- sortBy
Fields to sort by. The syntax is identical to
sortin Aggregates.sort (see Sorts). Sorting is required by certain functions and may be required by some windows (see Windows for more details). Sorting is used only for the purpose of computing window functions and does not guarantee ordering of the output documents.- output
A nonempty list of window output fields. Specifying an empty list is not an error, but the resulting stage does not do anything useful.
- returns
The
$setWindowFieldspipeline stage.
- Since
4.3
- Note
Requires MongoDB 5.0 or greater.
- See also
-
def
setWindowFields[TExpression >: Null](partitionBy: Option[TExpression], sortBy: Option[Bson], output: WindowOutputField, moreOutput: WindowOutputField*): Bson
Creates a
$setWindowFieldspipeline stage, which allows using window operators.Creates a
$setWindowFieldspipeline stage, which allows using window operators. This stage partitions the input documents similarly to the $group pipeline stage, optionally sorts them, computes fields in the documents by computing window functions over windows specified per function, and outputs the documents. The important difference from the$grouppipeline stage is that documents belonging to the same partition or window are not folded into a single document.- TExpression
The
partitionByexpression type.- partitionBy
Optional partitioning of data specified like
idin Aggregates.group. IfNone, then all documents belong to the same partition.- sortBy
Fields to sort by. The syntax is identical to
sortin Aggregates.sort (see Sorts). Sorting is required by certain functions and may be required by some windows (see Windows for more details). Sorting is used only for the purpose of computing window functions and does not guarantee ordering of the output documents.- output
- moreOutput
More window output fields.
- returns
The
$setWindowFieldspipeline stage.
- Since
4.3
- Note
Requires MongoDB 5.0 or greater.
- See also
-
def
skip(skip: Int): Bson
Creates a
$skippipeline stageCreates a
$skippipeline stage- skip
the number of documents to skip
- returns
the
$skippipeline stage
-
def
sort(sort: Bson): Bson
Creates a
$sortpipeline stage for the specified sort specificationCreates a
$sortpipeline stage for the specified sort specification- sort
the sort specification
- See also
Sorts
-
def
sortByCount[TExpression](filter: TExpression): Bson
Creates a
$sortByCountpipeline stage for the specified filterCreates a
$sortByCountpipeline stage for the specified filter- TExpression
the expression type
- filter
the filter specification
- returns
the
$sortByCountpipeline stage
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- See also
Sorts
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unionWith(collection: String, pipeline: Bson*): Bson
Creates a
$unionWithpipeline stage.Creates a
$unionWithpipeline stage.- collection
the name of the collection in the same database to perform the union with.
- pipeline
the pipeline to run on the union.
- returns
the
$unionWithpipeline stage
-
def
unset(fields: String*): Bson
Creates an
$unsetpipeline stage that removes/excludes fields from documentsCreates an
$unsetpipeline stage that removes/excludes fields from documents- fields
the fields to exclude. May use dot notation.
- returns
the
$unsetpipeline stage
- Since
4.8
- See also
-
def
unwind(fieldName: String, unwindOptions: UnwindOptions): Bson
Creates a
$unwindpipeline stage for the specified field name, which must be prefixed by a$sign.Creates a
$unwindpipeline stage for the specified field name, which must be prefixed by a$sign.- fieldName
the field name, prefixed by a
$sign- returns
the
$unwindpipeline stage
- Since
1.1
- See also
-
def
unwind(fieldName: String): Bson
Creates a
$unwindpipeline stage for the specified field name, which must be prefixed by a$sign.Creates a
$unwindpipeline stage for the specified field name, which must be prefixed by a$sign.- fieldName
the field name, prefixed by a
$sign- returns
the
$unwindpipeline stage
- See also
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated