S

Loading…

Class

AggregateCursor

A lazy, batched cursor over the results of an aggregation. It reads like a FindCursor: nothing is sent until the first read, documents arrive in batches, and toArray() and for await close the cursor for you.

class AggregateCursor<TResult extends object = Document> implements AsyncIterable<TResult>

Defined in packages/driver/src/cursor.ts:242

Constructors#

Methods#

M

[asyncIterator]

#
[asyncIterator](): AsyncGenerator<TResult, void, undefined>

Iterates the remaining documents, closing the cursor when the loop ends.

Defined in packages/driver/src/cursor.ts:303

M

next

#
next(): Promise<TResult | null>

Returns the next document, or null when the results are exhausted or the cursor is closed.

Defined in packages/driver/src/cursor.ts:280

M

toArray

#
toArray(): Promise<TResult[]>

Reads all remaining documents into an array and closes the cursor. Large result sets are held in memory; iterate instead when they may be large.

Defined in packages/driver/src/cursor.ts:288

Used by#