Method ToListAsync

| MongoDB CSharp Driver API Reference (original) (raw)

Namespace

MongoDB.Driver

Assembly

MongoDB.Driver.dll

ToListAsync(IAsyncCursor, CancellationToken)

Returns a list containing all the documents returned by a cursor.

public static Task<List<TDocument>> ToListAsync<TDocument>(this IAsyncCursor<TDocument> source, CancellationToken cancellationToken = default)

Parameters

source IAsyncCursor

The source.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<List>

A Task whose value is the list of documents.

Type Parameters

TDocument

The type of the document.