Table of Contents

Method First

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

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

Returns the first document of a cursor.

public static TDocument First<TDocument>(this IAsyncCursor<TDocument> cursor, CancellationToken cancellationToken = default)

Parameters

cursor IAsyncCursor<TDocument>

The cursor.

cancellationToken CancellationToken

The cancellation token.

Returns

TDocument

The first document.

Type Parameters

TDocument

The type of the document.