Method SingleOrDefault
SingleOrDefault<TResult>(IAggregateFluent<TResult>, CancellationToken)
Returns the only document of the aggregate result, or the default value if the result set is empty. Throws an exception if the result set contains more than one document.
public static TResult SingleOrDefault<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)
Parameters
aggregateIAggregateFluent<TResult>The aggregate.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- TResult
The fluent aggregate interface.
Type Parameters
TResultThe type of the result.