AggregateQuery

case class AggregateQuery[TResult](wrapped: AggregatePublisher[TResult]) extends Query[TResult]

Observable for aggregate

Type parameters:
TResult

The type of the result.

Value parameters:
wrapped

the underlying java AggregateQuery

trait Serializable
trait Product
trait Equals
trait Query[TResult]
class Object
trait Matchable
class Any

Value members

Concrete methods

def allowDiskUse(allowDiskUse: Boolean): AggregateQuery[TResult]

Enables writing to temporary files. A null value indicates that it's unspecified.

Enables writing to temporary files. A null value indicates that it's unspecified.

Aggregation

Value parameters:
allowDiskUse

true if writing to temporary files is enabled

Returns:

this

def batchSize(batchSize: Int): AggregateQuery[TResult]

Sets the number of documents to return per batch.

Sets the number of documents to return per batch.

Value parameters:
batchSize

the batch size

Returns:

this

def bypassDocumentValidation(bypassDocumentValidation: Boolean): AggregateQuery[TResult]

Sets the bypass document level validation flag.

Sets the bypass document level validation flag.

'''Note:''': This only applies when an $out stage is specified.

Aggregation

Value parameters:
bypassDocumentValidation

If true, allows the write to opt-out of document level validation.

Returns:

this

Note:

Requires MongoDB 3.2 or greater

def collation(collation: Collation): AggregateQuery[TResult]

Sets the collation options

Sets the collation options

Value parameters:
collation

the collation options to use

Returns:

this

Note:

A null value represents the server default.

Requires MongoDB 3.4 or greater

def comment(comment: String): AggregateQuery[TResult]

Sets the comment for this operation. A null value means no comment is set.

Sets the comment for this operation. A null value means no comment is set.

Value parameters:
comment

the comment

Returns:

this

Note:

Requires MongoDB 3.6 or greater

def comment(comment: BsonValue): AggregateQuery[TResult]

Sets the comment for this operation. A null value means no comment is set.

Sets the comment for this operation. A null value means no comment is set.

Value parameters:
comment

the comment

Returns:

this

Note:

The comment can be any valid BSON type for server versions 4.4 and above. Server versions between 3.6 and 4.2 only support string as comment, and providing a non-string type will result in a server-side error.

override def execute: ZStream[Any, Throwable, TResult]
Definition Classes
def explain[ExplainResult]()(implicit ct: ClassTag[ExplainResult]): Task[ExplainResult]

Explain the execution plan for this operation with the server's default verbosity level

Explain the execution plan for this operation with the server's default verbosity level

Type parameters:
ExplainResult

The type of the result

Returns:

the execution plan

Note:

Requires MongoDB 3.6 or greater

def explain[ExplainResult](verbosity: ExplainVerbosity)(implicit ct: ClassTag[ExplainResult]): Task[ExplainResult]

Explain the execution plan for this operation with the given verbosity level

Explain the execution plan for this operation with the given verbosity level

Type parameters:
ExplainResult

The type of the result

Value parameters:
verbosity

the verbosity of the explanation

Returns:

the execution plan

Note:

Requires MongoDB 3.6 or greater

def first(): Task[Option[TResult]]

Helper to return a single observable limited to the first result.

Helper to return a single observable limited to the first result.

Returns:

a single observable which will the first result.

def hint(hint: Hint): AggregateQuery[TResult]

Sets the hint for which index to use. A null value means no hint is set.

Sets the hint for which index to use. A null value means no hint is set.

Value parameters:
hint

the hint

Returns:

this

Note:

Requires MongoDB 3.6 or greater

def let(variables: Bson): AggregateQuery[TResult]

Add top-level variables to the aggregation.

Add top-level variables to the aggregation.

For MongoDB 5.0+, the aggregate command accepts a "let" option. This option is a document consisting of zero or more fields representing variables that are accessible to the aggregation pipeline. The key is the name of the variable and the value is a constant in the aggregate expression language. Each parameter name is then usable to access the value of the corresponding expression with the "$$" syntax within aggregate expression contexts which may require the use of '$expr' or a pipeline.

Value parameters:
variables

the variables

Returns:

this

Note:

Requires MongoDB 5.0 or greater

def maxAwaitTime(duration: Duration): AggregateQuery[TResult]

Sets the maximum await execution time on the server for this operation.

Sets the maximum await execution time on the server for this operation.

Max Time

Value parameters:
duration

the duration

Returns:

this

Note:

Requires MongoDB 3.6 or greater

def maxTime(duration: Duration): AggregateQuery[TResult]

Sets the maximum execution time on the server for this operation.

Sets the maximum execution time on the server for this operation.

Max Time

Value parameters:
duration

the duration

Returns:

this

def toCollection(): Task[Unit]

Aggregates documents according to the specified aggregation pipeline, which must end with a $out stage.

Aggregates documents according to the specified aggregation pipeline, which must end with a $out stage.

Aggregation

Returns:

an empty Observable that indicates when the operation has completed

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product