Skip to main content

MongoAggregateIterable

Processes the results of MongoDB aggregation operations.


all


all() : java.util.List<Values>

Description

Returns all documents from the aggregation result.

How To Use
const docs = collection.aggregate(...).all();
Return

( java.util.List )

The list of documents.


first


first() : Values

Description

Returns the first document from the aggregation result.

How To Use
const doc = collection.aggregate(...).first();
Return

( Values )

The first document or null if there are no results.


forEach


forEach(consumer: java.util.function.Consumer<Values>) : MongoAggregateIterable

Description

Performs an action for each document in the aggregation result.

How To Use
collection.aggregate(...).forEach((doc) => { /* process doc */ });
Attributes
NAMETYPEDESCRIPTION
consumerjava.util.function.ConsumerThe action to perform for each document.
Return

( MongoAggregateIterable )

This instance for chaining.


forEach(func: org.graalvm.polyglot.Value) : MongoAggregateIterable

Description

Executes a function for each document in the aggregation result.

How To Use
collection.aggregate(...).forEach((doc) => { /* process doc */ });
Attributes
NAMETYPEDESCRIPTION
funcorg.graalvm.polyglot.ValueThe function to execute for each document.
Return

( MongoAggregateIterable )

This instance for chaining.