toCollection

suspend fun toCollection()

Aggregates documents according to the specified aggregation pipeline, which must end with an $out or $merge stage. Calling this method is the preferred alternative to consuming this AggregateFlow, because this method does what is explicitly requested without executing implicit operations.

See also

Throws

if the pipeline does not end with an $out or $merge stage