Method SingleOrDefaultAsync
SingleOrDefaultAsync<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Gets a single result or null.
public static Task<TProjection> SingleOrDefaultAsync<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, CancellationToken cancellationToken = default)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<TProjection>
A Task whose result is the single result or null.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).