Method FirstAsync
FirstAsync<TDocument>(IAsyncCursorSource<TDocument>, CancellationToken)
Returns the first document of a cursor returned by a cursor source.
public static Task<TDocument> FirstAsync<TDocument>(this IAsyncCursorSource<TDocument> source, CancellationToken cancellationToken = default)
Parameters
sourceIAsyncCursorSource<TDocument>The source.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<TDocument>
A Task whose result is the first document.
Type Parameters
TDocumentThe type of the document.