Table of Contents

Method ToListAsync

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

ToListAsync<TDocument>(IAsyncCursorSource<TDocument>, CancellationToken)

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

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

Parameters

source IAsyncCursorSource<TDocument>

The source.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<List<TDocument>>

A Task whose value is the list of documents.

Type Parameters

TDocument

The type of the document.