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
cursorIAsyncCursor<TDocument>The cursor.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<TDocument>
A Task whose result is the first document.
Type Parameters
TDocumentThe type of the document.