Method Single

| MongoDB CSharp Driver API Reference (original) (raw)

Namespace

MongoDB.Driver

Assembly

MongoDB.Driver.dll

Single(IAggregateFluent, CancellationToken)

Returns the only document of the aggregate result. Throws an exception if the result set does not contain exactly one document.

public static TResult Single<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)

Parameters

aggregate IAggregateFluent

The aggregate.

cancellationToken CancellationToken

The cancellation token.

Returns

TResult

The fluent aggregate interface.

Type Parameters

TResult

The type of the result.