object Accumulators
Builders for accumulators used in the group pipeline stage of an aggregation pipeline.
- Since
1.0
- See also
- Alphabetic
- By Inheritance
- Accumulators
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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 accumulator(fieldName: String, initFunction: String, initArgs: Seq[String], accumulateFunction: String, accumulateArgs: Seq[String], mergeFunction: String, finalizeFunction: String, lang: String): BsonField
Creates an
$accumulator
pipeline stageCreates an
$accumulator
pipeline stage- fieldName
the field name
- initFunction
a function used to initialize the state
- initArgs
init function’s arguments (may be null)
- accumulateFunction
a function used to accumulate documents
- accumulateArgs
additional accumulate function’s arguments (may be null). The first argument to the function is ‘state’.
- mergeFunction
a function used to merge two internal states, e.g. accumulated on different shards or threads. It returns the resulting state of the accumulator.
- finalizeFunction
a function used to finalize the state and return the result (may be null)
- lang
a language specifier
- returns
the
$accumulator
pipeline stage
- Since
1.2
- Note
Requires MongoDB 4.4 or greater
- See also
- def accumulator(fieldName: String, initFunction: String, initArgs: Seq[String], accumulateFunction: String, accumulateArgs: Seq[String], mergeFunction: String, finalizeFunction: String): BsonField
Creates an
$accumulator
pipeline stageCreates an
$accumulator
pipeline stage- fieldName
the field name
- initFunction
a function used to initialize the state
- initArgs
init function’s arguments (may be null)
- accumulateFunction
a function used to accumulate documents
- accumulateArgs
additional accumulate function’s arguments (may be null). The first argument to the function is ‘state’.
- mergeFunction
a function used to merge two internal states, e.g. accumulated on different shards or threads. It returns the resulting state of the accumulator.
- finalizeFunction
a function used to finalize the state and return the result (may be null)
- returns
the
$accumulator
pipeline stage
- Since
1.2
- Note
Requires MongoDB 4.4 or greater
- See also
- def accumulator(fieldName: String, initFunction: String, accumulateFunction: String, mergeFunction: String, finalizeFunction: String): BsonField
Creates an
$accumulator
pipeline stageCreates an
$accumulator
pipeline stage- fieldName
the field name
- initFunction
a function used to initialize the state
- accumulateFunction
a function used to accumulate documents
- mergeFunction
a function used to merge two internal states, e.g. accumulated on different shards or threads. It returns the resulting state of the accumulator.
- finalizeFunction
a function used to finalize the state and return the result (may be null)
- returns
the
$accumulator
pipeline stage
- Since
1.2
- Note
Requires MongoDB 4.4 or greater
- See also
- def accumulator(fieldName: String, initFunction: String, accumulateFunction: String, mergeFunction: String): BsonField
Creates an
$accumulator
pipeline stageCreates an
$accumulator
pipeline stage- fieldName
the field name
- initFunction
a function used to initialize the state
- accumulateFunction
a function used to accumulate documents
- mergeFunction
a function used to merge two internal states, e.g. accumulated on different shards or threads. It returns the resulting state of the accumulator.
- returns
the
$accumulator
pipeline stage
- Since
1.2
- Note
Requires MongoDB 4.4 or greater
- See also
- def addToSet[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing all unique values that results from applying the given expression to each document in a group of documents that share the same group by key.Gets a field name for a
$group
operation representing all unique values that results from applying the given expression to each document in a group of documents that share the same group by key.- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- See also
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def avg[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing the average of the values of the given expression when applied to all members of the group.Gets a field name for a
$group
operation representing the average of the values of the given expression when applied to all members of the group.- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- See also
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def first[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing the value of the given expression when applied to the first member of the group.Gets a field name for a
$group
operation representing the value of the given expression when applied to the first member of the group.- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- See also
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def last[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing the value of the given expression when applied to the last member of the group.Gets a field name for a
$group
operation representing the value of the given expression when applied to the last member of the group.- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- See also
- def max[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing the maximum of the values of the given expression when applied to all members of the group.Gets a field name for a
$group
operation representing the maximum of the values of the given expression when applied to all members of the group.- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- See also
- def min[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing the minimum of the values of the given expression when applied to all members of the group.Gets a field name for a
$group
operation representing the minimum of the values of the given expression when applied to all members of the group.- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- See also
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def push[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing an array of all values that results from applying an expression to each document in a group of documents that share the same group by key.Gets a field name for a
$group
operation representing an array of all values that results from applying an expression to each document in a group of documents that share the same group by key.- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- See also
- def stdDevPop[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing the sample standard deviation of the values of the given expression when applied to all members of the group.Gets a field name for a
$group
operation representing the sample standard deviation of the values of the given expression when applied to all members of the group.Use if the values encompass the entire population of data you want to represent and do not wish to generalize about a larger population.
- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- Since
1.1
- Note
Requires MongoDB 3.2 or greater
- See also
- def stdDevSamp[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing the sample standard deviation of the values of the given expression when applied to all members of the group.Gets a field name for a
$group
operation representing the sample standard deviation of the values of the given expression when applied to all members of the group.Use if the values encompass a sample of a population of data from which to generalize about the population.
- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- Since
1.1
- Note
Requires MongoDB 3.2 or greater
- See also
- def sum[TExpression](fieldName: String, expression: TExpression): BsonField
Gets a field name for a
$group
operation representing the sum of the values of the given expression when applied to all members of the group.Gets a field name for a
$group
operation representing the sum of the values of the given expression when applied to all members of the group.- TExpression
the expression type
- fieldName
the field name
- expression
the expression
- returns
the field
- See also
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
This is the documentation for the MongoDB Scala driver.
Driver structure
The mongodb scala driver.
To get started you need a MongoClient instance, either from a connection string or via a org.mongodb.scala.MongoClientSettings.
Notable packages include: