Aggregate

mongo4cats.operations.Aggregate
See theAggregate companion class
object Aggregate extends Aggregate

Attributes

Companion
class
Graph
Supertypes
class Aggregate
trait Serializable
trait AsJavaConverters
class Object
trait Matchable
class Any
Show all
Self type
Aggregate.type

Members list

Type members

Classlikes

final case class Facet(name: String, pipeline: Aggregate)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Inherited methods

def addFields[TExpression](field: (String, TExpression), fields: (String, TExpression)*): Aggregate

Attributes

Inherited from:
Aggregate
def addFields[TExpression](fields: List[(String, TExpression)]): Aggregate

Creates a $addFields pipeline stage. With $addFields you can add new fields the document.

Creates a $addFields pipeline stage. With $addFields you can add new fields the document.

Value parameters

name

the name of the new field

value

the value of the new field

Attributes

Returns

Aggregate with $addFields pipeline stage https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/

Inherited from:
Aggregate
def asJava[K, V](m: Map[K, V]): ConcurrentMap[K, V]

Attributes

Inherited from:
AsJavaConverters
def asJava[K, V](m: Map[K, V]): Map[K, V]

Attributes

Inherited from:
AsJavaConverters
def asJava[K, V](m: Map[K, V]): Map[K, V]

Attributes

Inherited from:
AsJavaConverters
def asJava[A](s: Set[A]): Set[A]

Attributes

Inherited from:
AsJavaConverters
def asJava[A](s: Set[A]): Set[A]

Attributes

Inherited from:
AsJavaConverters
def asJava[A](s: Seq[A]): List[A]

Attributes

Inherited from:
AsJavaConverters
def asJava[A](s: Seq[A]): List[A]

Attributes

Inherited from:
AsJavaConverters
def asJava[A](b: Buffer[A]): List[A]

Attributes

Inherited from:
AsJavaConverters
def asJava[A](i: Iterable[A]): Iterable[A]

Attributes

Inherited from:
AsJavaConverters
def asJava[A](i: Iterator[A]): Iterator[A]

Attributes

Inherited from:
AsJavaConverters
def asJavaCollection[A](i: Iterable[A]): Collection[A]

Attributes

Inherited from:
AsJavaConverters
def asJavaDictionary[K, V](m: Map[K, V]): Dictionary[K, V]

Attributes

Inherited from:
AsJavaConverters
def asJavaEnumeration[A](i: Iterator[A]): Enumeration[A]

Attributes

Inherited from:
AsJavaConverters
def bucket[TExpression](groupBy: TExpression, boundaries: Seq[Double], options: BucketOptions): Aggregate

Creates a $bucket pipeline stage

Creates a $bucket pipeline stage

Value parameters

boundaries

the boundaries of the buckets

groupBy

the criteria to group By

options

the optional values for the $bucket stage

Attributes

Returns

Aggregate $bucket pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/bucket/

Inherited from:
Aggregate
def bucketAuto[TExpression](groupBy: TExpression, buckets: Int, options: BucketAutoOptions): Aggregate

Creates a $bucketAuto pipeline stage.

Creates a $bucketAuto pipeline stage.

Value parameters

buckets

the number of the buckets

groupBy

the criteria to group By

options

the optional values for the $bucketAuto stage

Attributes

Returns

Aggregate with $bucketAuto pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/bucketAuto/

Inherited from:
Aggregate
def combinedWith(anotherAggregate: Aggregate): Aggregate

Merges 2 aggregation pipelines together.

Merges 2 aggregation pipelines together.

Value parameters

anotherAggregate

the aggregate to be merged with

Attributes

Returns

the aggregate pipeline

Inherited from:
Aggregate
def count(field: String): Aggregate

Creates a $count pipeline stage using the named field to store the result.

Creates a $count pipeline stage using the named field to store the result.

Value parameters

field

the field in which to store the count

Attributes

Returns

Aggregate with $count pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/count/

Inherited from:
Aggregate

Creates a $count pipeline stage using the field name "count" to store the result.

Creates a $count pipeline stage using the field name "count" to store the result.

Attributes

Returns

Aggregate with $count pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/count/

Inherited from:
Aggregate
def densify(field: String, range: DensifyRange, options: DensifyOptions): Aggregate

Creates a $densify pipeline stage, which adds documents to a sequence of documents where certain values in the field are missing.

Creates a $densify pipeline stage, which adds documents to a sequence of documents where certain values in the field are missing.

Value parameters

field

The field to densify.

options

The densify options.

range

The range.

Attributes

Returns

Aggregate with requested pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/densify/

Inherited from:
Aggregate
override def equals(other: Any): Boolean

Compares the receiver object (this) with the argument object (that) for equivalence.

Compares the receiver object (this) with the argument object (that) for equivalence.

Any implementation of this method should be an equivalence relation:

  • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type Any if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).

Value parameters

that

the object to compare against this object for equality.

Attributes

Returns

true if the receiver object is equivalent to the argument; false otherwise.

Definition Classes
Aggregate -> Any
Inherited from:
Aggregate
def facet(facets: Facet*): Aggregate

Attributes

Inherited from:
Aggregate
def facet(facets: List[Facet]): Aggregate

Creates a facet pipeline stage.

Creates a facet pipeline stage.

Value parameters

facets

the facets to use

Attributes

Returns

Aggregate with $facets pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/facet/

Inherited from:
Aggregate
def fill(options: FillOptions, output: FillOutputField, outputs: FillOutputField*): Aggregate

Attributes

Inherited from:
Aggregate
def fill(options: FillOptions, outputs: List[FillOutputField]): Aggregate

Creates a $fill pipeline stage, which assigns values to fields when they are Null or missing.

Creates a $fill pipeline stage, which assigns values to fields when they are Null or missing.

Value parameters

options

The fill options.

outputs

The FillOutputField.

Attributes

Returns

Aggregate with requested pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/fill/

Inherited from:
Aggregate
def geoNear(point: Point, distanceField: String, options: GeoNearOptions): Aggregate

Creates a $geoNear pipeline stage that outputs documents in order of nearest to farthest from a specified point.

Creates a $geoNear pipeline stage that outputs documents in order of nearest to farthest from a specified point.

Value parameters

distanceField

The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation.

options

GeoNearOptions

point

The point for which to find the closest documents.

Attributes

Returns

Aggregate with requested pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/geoNear/

Inherited from:
Aggregate
def graphLookup[TExpression](from: String, startWith: TExpression, connectFromField: String, connectToField: String, as: String, options: GraphLookupOptions): Aggregate

Creates a graphLookup pipeline stage for the specified filter.

Creates a graphLookup pipeline stage for the specified filter.

Value parameters

as

name of field in output document

connectFromField

the from field

connectToField

the to field

from

the collection to query

options

optional values for the graphLookup

startWith

the expression to start the graph lookup with

Attributes

Returns

Aggregate with $graphLookup pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/graphLookup/

Inherited from:
Aggregate
def group[TExpression](id: TExpression, fieldAccumulators: Accumulator): Aggregate

Creates a $group pipeline stage for the specified filter.

Creates a $group pipeline stage for the specified filter.

Value parameters

fieldAccumulators

zero or more field accumulator pairs

id

the id expression for the group

Attributes

Returns

Aggregate with $group pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/group/

Inherited from:
Aggregate
override def hashCode(): Int

Calculates a hash code value for the object.

Calculates a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
Aggregate -> Any
Inherited from:
Aggregate
def limit(n: Int): Aggregate

Creates a $limit pipeline stage for the specified filter

Creates a $limit pipeline stage for the specified filter

Value parameters

n

the limit

Attributes

Returns

Aggregate with $limit pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/limi/

Inherited from:
Aggregate
def lookup(from: String, pipeline: Aggregate, as: String): Aggregate

Creates a $lookup pipeline stage, joining the current collection with the one specified in from using the given pipeline.

Creates a $lookup pipeline stage, joining the current collection with the one specified in from using the given pipeline.

Value parameters

as

the name of the new array field to add to the input documents.

from

the name of the collection in the same database to perform the join with.

pipeline

the pipeline to run on the joined collection.

Attributes

Returns

Aggregate with $lookup pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/

Inherited from:
Aggregate
def lookup(from: String, localField: String, foreignField: String, as: String): Aggregate

Creates a $lookup pipeline stage, joining the current collection with the one specified in from using equality match between the local field and the foreign field.

Creates a $lookup pipeline stage, joining the current collection with the one specified in from using equality match between the local field and the foreign field.

Value parameters

as

the name of the new array field to add to the input documents.

foreignField

the field in the from collection to match values against.

from

the name of the collection in the same database to perform the join with.

localField

the field from the local collection to match values against.

Attributes

Returns

Aggregate with $lookup pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/

Inherited from:
Aggregate
def matchBy(filter: Filter): Aggregate

Creates a $match pipeline stage for the specified filter.

Creates a $match pipeline stage for the specified filter.

Value parameters

filter

the filter to match

Attributes

Returns

Aggregate with $match pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/match/

Inherited from:
Aggregate
def merge(collectionName: String, options: MergeOptions): Aggregate

Creates a $merge pipeline stage that merges into the specified collection using the specified options.

Creates a $merge pipeline stage that merges into the specified collection using the specified options.

Value parameters

collectionName

the name of the collection to merge into

options

the merge options

Attributes

Returns

Aggregate with $merge pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/merge/

Inherited from:
Aggregate
def out(databaseName: String, collectionName: String): Aggregate

Creates a $out pipeline stage that supports outputting to a different database.

Creates a $out pipeline stage that supports outputting to a different database.

Value parameters

collectionName

the collection name

databaseName

the database name

Attributes

Returns

Aggregate with $out pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/out/

Inherited from:
Aggregate
def out(collectionName: String): Aggregate

Creates a $out pipeline stage that writes into the specified collection

Creates a $out pipeline stage that writes into the specified collection

Value parameters

collectionName

the collection name

Attributes

Returns

Aggregate with $out pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/out/

Inherited from:
Aggregate
def project(projection: Projection): Aggregate

Creates a $project pipeline stage for the specified projection.

Creates a $project pipeline stage for the specified projection.

Value parameters

projection

the projection

Attributes

Returns

Aggregate with $project pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/project/

Inherited from:
Aggregate
def replaceWith[TExpression](value: TExpression): Aggregate

Creates a $replaceRoot pipeline stage. With $replaceWith you can promote an embedded document to the top-level. You can also specify a new document as the replacement.

Creates a $replaceRoot pipeline stage. With $replaceWith you can promote an embedded document to the top-level. You can also specify a new document as the replacement.

Value parameters

value

the new root value

Attributes

Returns

Aggregate with $replaceRoot pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/replaceWith/

Inherited from:
Aggregate
def sample(size: Int): Aggregate

Creates a $sample pipeline stage with the specified sample size.

Creates a $sample pipeline stage with the specified sample size.

Value parameters

size

the sample size

Attributes

Returns

Aggregate with $sample pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/sample/

Inherited from:
Aggregate
def search(collector: SearchCollector): Aggregate

Attributes

Inherited from:
Aggregate
def search(collector: SearchCollector, options: SearchOptions): Aggregate

Creates a $search pipeline stage supported by MongoDB Atlas. You may use $meta: "searchScore", e.g., via Projection.metaSearchScore(String), to extract the relevance score assigned to each found document.

Creates a $search pipeline stage supported by MongoDB Atlas. You may use $meta: "searchScore", e.g., via Projection.metaSearchScore(String), to extract the relevance score assigned to each found document.

Value parameters

collector

A search collector.

options

Optional $search pipeline stage fields.

Attributes

Returns

Aggregate with $search pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/search/

Inherited from:
Aggregate
def search(operator: SearchOperator): Aggregate

Attributes

Inherited from:
Aggregate
def search(operator: SearchOperator, options: SearchOptions): Aggregate

Creates a $search pipeline stage supported by MongoDB Atlas. You may use $meta: "searchScore", e.g., via Projection.metaSearchScore(String), to extract the relevance score assigned to each found document.

Creates a $search pipeline stage supported by MongoDB Atlas. You may use $meta: "searchScore", e.g., via Projection.metaSearchScore(String), to extract the relevance score assigned to each found document.

Value parameters

operator

A search operator.

options

Optional $search pipeline stage fields.

Attributes

Returns

Aggregate with requested pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/search/

Inherited from:
Aggregate
def searchMeta(collector: SearchCollector): Aggregate

Attributes

Inherited from:
Aggregate
def searchMeta(collector: SearchCollector, options: SearchOptions): Aggregate

Creates a $searchMeta pipeline stage supported by MongoDB Atlas. Unlike $search, it does not return found documents, instead it returns metadata, which in case of using the $search stage may be extracted by using $$SEARCH_META variable, e.g., via Projection.computedSearchMeta(String).

Creates a $searchMeta pipeline stage supported by MongoDB Atlas. Unlike $search, it does not return found documents, instead it returns metadata, which in case of using the $search stage may be extracted by using $$SEARCH_META variable, e.g., via Projection.computedSearchMeta(String).

Value parameters

collector

A search collector.

options

Optional $search pipeline stage fields.

Attributes

Returns

Aggregate with $searchMeta pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/searchMeta/

Inherited from:
Aggregate
def searchMeta(operator: SearchOperator): Aggregate

Attributes

Inherited from:
Aggregate
def searchMeta(operator: SearchOperator, options: SearchOptions): Aggregate

Creates a $searchMeta pipeline stage supported by MongoDB Atlas. Unlike $search, it does not return found documents, instead it returns metadata, which in case of using the $search stage may be extracted by using $$SEARCH_META variable, e.g., via Projection.computedSearchMeta(String).

Creates a $searchMeta pipeline stage supported by MongoDB Atlas. Unlike $search, it does not return found documents, instead it returns metadata, which in case of using the $search stage may be extracted by using $$SEARCH_META variable, e.g., via Projection.computedSearchMeta(String).

Value parameters

operator

A search operator.

options

Optional $search pipeline stage fields.

Attributes

Returns

Aggregate with $searchMeta pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/searchMeta/

Inherited from:
Aggregate
def set[TExpression](field: (String, TExpression), fields: (String, TExpression)*): Aggregate

Attributes

Inherited from:
Aggregate
def set[TExpression](fields: List[(String, TExpression)]): Aggregate

Creates a $set pipeline stage for the specified projection.

Creates a $set pipeline stage for the specified projection.

Value parameters

fields

the fields to add

Attributes

Returns

Aggregate with $set pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/set/

Inherited from:
Aggregate
def setWindowFields(sortBy: Sort, outputs: Seq[WindowOutputField]): Aggregate

Creates a $setWindowFields pipeline stage, which allows using window operators. This stage sorts input documents, computes fields in the documents by computing window functions over windows specified per function, and outputs the documents. Here, documents will belong to the same partition.

Creates a $setWindowFields pipeline stage, which allows using window operators. This stage sorts input documents, computes fields in the documents by computing window functions over windows specified per function, and outputs the documents. Here, documents will belong to the same partition.

Value parameters

output

A list of windowed computations. Specifying an empty list is not an error, but the resulting stage does not do anything useful.

sortBy

Fields to sort by. Sorting is required by certain functions and may be required by some windows. Sorting is used only for the purpose of computing window functions and does not guarantee ordering of the output documents.

Attributes

Returns

Aggregate with $setWindowFields pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/setWindowFields/

Inherited from:
Aggregate
def setWindowFields[TExpression](partitionBy: TExpression, sortBy: Sort, outputs: Seq[WindowOutputField]): Aggregate

Creates a $setWindowFields pipeline stage, which allows using window operators. This stage partitions the input documents similarly to the $group pipeline stage, 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 $group pipeline stage is that documents belonging to the same partition or window are not folded into a single document.

Creates a $setWindowFields pipeline stage, which allows using window operators. This stage partitions the input documents similarly to the $group pipeline stage, 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 $group pipeline stage is that documents belonging to the same partition or window are not folded into a single document.

Value parameters

output

A list of windowed computations. Specifying an empty list is not an error, but the resulting stage does not do anything useful.

partitionBy

Partitioning of data specified like id in $group.

sortBy

Fields to sort by. Sorting is required by certain functions and may be required by some windows. Sorting is used only for the purpose of computing window functions and does not guarantee ordering of the output documents.

Attributes

Returns

Aggregate with $setWindowFields pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/setWindowFields/

Inherited from:
Aggregate
def skip(n: Int): Aggregate

Creates a $skip pipeline stage.

Creates a $skip pipeline stage.

Value parameters

n

the number of documents to skip

Attributes

Returns

Aggregate with $skip pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/skip/

Inherited from:
Aggregate
def sort(sort: Sort): Aggregate

Creates a $sort pipeline stage for the specified sort specification.

Creates a $sort pipeline stage for the specified sort specification.

Value parameters

sort

the sort specification

Attributes

Returns

Aggregate with $sort pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/sort/

Inherited from:
Aggregate
def sortByCount[TExpression](filter: TExpression): Aggregate

Creates a $sortByCount pipeline stage for the specified filter.

Creates a $sortByCount pipeline stage for the specified filter.

Value parameters

filter

the filter specification

Attributes

Returns

Aggregate with $sortByCount pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/sortByCount/

Inherited from:
Aggregate
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Aggregate -> Any
Inherited from:
Aggregate
def unionWith(collection: String, pipeline: Aggregate): Aggregate

Creates a $unionWith pipeline stage.

Creates a $unionWith pipeline stage.

Value parameters

collection

the name of the collection in the same database to perform the union with.

pipeline

the pipeline to run on the union.

Attributes

Returns

Aggregate with $unionWith pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/unionWith/

Inherited from:
Aggregate
def unset(fields: String*): Aggregate

Attributes

Inherited from:
Aggregate
def unset(fields: List[String]): Aggregate

Creates an $unset pipeline stage. With $unset you can removes/excludes fields from documents.

Creates an $unset pipeline stage. With $unset you can removes/excludes fields from documents.

Value parameters

fields

the fields to exclude. May use dot notation.

Attributes

Returns

Aggregate with $unset aggregate stage https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/

Inherited from:
Aggregate
def unwind(fieldName: String, unwindOptions: UnwindOptions): Aggregate

Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a '$' sign.

Creates a $unwind pipeline stage for the specified field name, which must be prefixed by a '$' sign.

Value parameters

fieldName

the field name, prefixed by a '$' sign

unwindOptions

options for the unwind pipeline stage

Attributes

Returns

Aggregate with $unwind pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/unwind/

Inherited from:
Aggregate
def vectorSearch(path: FieldSearchPath, queryVector: Seq[Double], index: String, limit: Long, options: VectorSearchOptions): Aggregate

Creates a $vectorSearch pipeline stage supported by MongoDB Atlas. You may use the $meta: "vectorSearchScore" expression, e.g., via Projection.metaVectorSearchScore(String), to extract the relevance score assigned to each found document.

Creates a $vectorSearch pipeline stage supported by MongoDB Atlas. You may use the $meta: "vectorSearchScore" expression, e.g., via Projection.metaVectorSearchScore(String), to extract the relevance score assigned to each found document.

Value parameters

index

The name of the index to use.

limit

The limit on the number of documents produced by the pipeline stage.

options

Optional $vectorSearch pipeline stage fields.

path

The field to be searched.

queryVector

The query vector. The number of dimensions must match that of the index.

Attributes

Returns

The Aggregate with $vectorSearch pipeline stage https://docs.mongodb.com/manual/reference/operator/aggregation/vectorSearch/

Inherited from:
Aggregate