Class IFindFluentExtensions
Extension methods for IFindFluent<TDocument, TProjection>
public static class IFindFluentExtensions
- Inheritance
-
IFindFluentExtensions
- Inherited Members
Methods
AnyAsync<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Determine if there are any results.
public static Task<bool> AnyAsync<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, CancellationToken cancellationToken = default)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
cancellationTokenCancellationTokenThe cancellation token.
Returns
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
Any<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Determine if there are any results.
public static bool Any<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, CancellationToken cancellationToken = default)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- bool
True if there is at least one document.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
FirstAsync<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Get the first result.
public static Task<TProjection> FirstAsync<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 first result.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
FirstOrDefaultAsync<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Get the first result or null.
public static Task<TProjection> FirstOrDefaultAsync<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 first result or null.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
FirstOrDefault<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Get the first result or null.
public static TProjection FirstOrDefault<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, CancellationToken cancellationToken = default)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- TProjection
A Task whose result is the first result or null.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
First<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Get the first result.
public static TProjection First<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, CancellationToken cancellationToken = default)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- TProjection
A Task whose result is the first result.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
Project<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, ProjectionDefinition<TDocument, BsonDocument>)
Projects the result.
public static IFindFluent<TDocument, BsonDocument> Project<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, ProjectionDefinition<TDocument, BsonDocument> projection)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
projectionProjectionDefinition<TDocument, BsonDocument>The projection.
Returns
- IFindFluent<TDocument, BsonDocument>
The fluent find interface.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
Project<TDocument, TProjection, TNewProjection>(IFindFluent<TDocument, TProjection>, Expression<Func<TDocument, TNewProjection>>)
Projects the result.
public static IFindFluent<TDocument, TNewProjection> Project<TDocument, TProjection, TNewProjection>(this IFindFluent<TDocument, TProjection> find, Expression<Func<TDocument, TNewProjection>> projection)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
projectionExpression<Func<TDocument, TNewProjection>>The projection.
Returns
- IFindFluent<TDocument, TNewProjection>
The fluent find interface.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
TNewProjectionThe type of the new projection.
SingleAsync<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Gets a single result.
public static Task<TProjection> SingleAsync<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.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
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).
SingleOrDefault<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Gets a single result or null.
public static TProjection SingleOrDefault<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, CancellationToken cancellationToken = default)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- 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).
Single<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, CancellationToken)
Gets a single result.
public static TProjection Single<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, CancellationToken cancellationToken = default)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- TProjection
A Task whose result is the single result.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
SortByDescending<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, Expression<Func<TDocument, object>>)
Sorts the results by a descending field.
public static IOrderedFindFluent<TDocument, TProjection> SortByDescending<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, Expression<Func<TDocument, object>> field)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
fieldExpression<Func<TDocument, object>>The field.
Returns
- IOrderedFindFluent<TDocument, TProjection>
The fluent find interface.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
SortBy<TDocument, TProjection>(IFindFluent<TDocument, TProjection>, Expression<Func<TDocument, object>>)
Sorts the results by an ascending field.
public static IOrderedFindFluent<TDocument, TProjection> SortBy<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, Expression<Func<TDocument, object>> field)
Parameters
findIFindFluent<TDocument, TProjection>The fluent find.
fieldExpression<Func<TDocument, object>>The field.
Returns
- IOrderedFindFluent<TDocument, TProjection>
The fluent find interface.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
ThenByDescending<TDocument, TProjection>(IOrderedFindFluent<TDocument, TProjection>, Expression<Func<TDocument, object>>)
Adds a descending field to the existing sort.
public static IOrderedFindFluent<TDocument, TProjection> ThenByDescending<TDocument, TProjection>(this IOrderedFindFluent<TDocument, TProjection> find, Expression<Func<TDocument, object>> field)
Parameters
findIOrderedFindFluent<TDocument, TProjection>The fluent find.
fieldExpression<Func<TDocument, object>>The field.
Returns
- IOrderedFindFluent<TDocument, TProjection>
The fluent find interface.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).
ThenBy<TDocument, TProjection>(IOrderedFindFluent<TDocument, TProjection>, Expression<Func<TDocument, object>>)
Adds an ascending field to the existing sort.
public static IOrderedFindFluent<TDocument, TProjection> ThenBy<TDocument, TProjection>(this IOrderedFindFluent<TDocument, TProjection> find, Expression<Func<TDocument, object>> field)
Parameters
findIOrderedFindFluent<TDocument, TProjection>The fluent find.
fieldExpression<Func<TDocument, object>>The field.
Returns
- IOrderedFindFluent<TDocument, TProjection>
The fluent find interface.
Type Parameters
TDocumentThe type of the document.
TProjectionThe type of the projection (same as TDocument if there is no projection).