Table of Contents

Method First

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Core.dll

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

Returns the first document of a cursor returned by a cursor source.

public static TDocument First<TDocument>(this IAsyncCursorSource<TDocument> source, CancellationToken cancellationToken = default)

Parameters

source IAsyncCursorSource<TDocument>

The source.

cancellationToken CancellationToken

The cancellation token.

Returns

TDocument

The first document.

Type Parameters

TDocument

The type of the document.