Method Single
Single<TDocument>(IAsyncCursor<TDocument>, CancellationToken)
Returns the only document of a cursor. This method throws an exception if the cursor does not contain exactly one document.
public static TDocument Single<TDocument>(this IAsyncCursor<TDocument> cursor, CancellationToken cancellationToken = default)
Parameters
cursor
IAsyncCursor<TDocument>The cursor.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- TDocument
The only document of a cursor.
Type Parameters
TDocument
The type of the document.