Method FirstAsync
FirstAsync<TDocument>(IAsyncCursor<TDocument>, CancellationToken)
Returns the first document of a cursor.
public static Task<TDocument> FirstAsync<TDocument>(this IAsyncCursor<TDocument> cursor, CancellationToken cancellationToken = default)
Parameters
cursor
IAsyncCursor<TDocument>The cursor.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<TDocument>
A Task whose result is the first document.
Type Parameters
TDocument
The type of the document.