Class IAggregateFluentExtensions
- Namespace
- MongoDB.Driver
- Assembly
- MongoDB.Driver.dll
public static class IAggregateFluentExtensions
- Inheritance
-
IAggregateFluentExtensions
- Inherited Members
-
Methods
BucketAuto<TResult, TValue>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, int, AggregateBucketAutoOptions)
public static IAggregateFluent<AggregateBucketAutoResult<TValue>> BucketAuto<TResult, TValue>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TValue>> groupBy, int buckets, AggregateBucketAutoOptions options = null)
Parameters
aggregate
IAggregateFluent<TResult>
groupBy
Expression<Func<TResult, TValue>>
buckets
int
options
AggregateBucketAutoOptions
Returns
- IAggregateFluent<AggregateBucketAutoResult<TValue>>
Type Parameters
TResult
TValue
BucketAuto<TResult, TValue, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, int, Expression<Func<IGrouping<TValue, TResult>, TNewResult>>, AggregateBucketAutoOptions)
public static IAggregateFluent<TNewResult> BucketAuto<TResult, TValue, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TValue>> groupBy, int buckets, Expression<Func<IGrouping<TValue, TResult>, TNewResult>> output, AggregateBucketAutoOptions options = null)
Parameters
aggregate
IAggregateFluent<TResult>
groupBy
Expression<Func<TResult, TValue>>
buckets
int
output
Expression<Func<IGrouping<TValue, TResult>, TNewResult>>
options
AggregateBucketAutoOptions
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TValue
TNewResult
Bucket<TResult, TValue>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, IEnumerable<TValue>, AggregateBucketOptions<TValue>)
public static IAggregateFluent<AggregateBucketResult<TValue>> Bucket<TResult, TValue>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TValue>> groupBy, IEnumerable<TValue> boundaries, AggregateBucketOptions<TValue> options = null)
Parameters
aggregate
IAggregateFluent<TResult>
groupBy
Expression<Func<TResult, TValue>>
boundaries
IEnumerable<TValue>
options
AggregateBucketOptions<TValue>
Returns
- IAggregateFluent<AggregateBucketResult<TValue>>
Type Parameters
TResult
TValue
Bucket<TResult, TValue, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, IEnumerable<TValue>, Expression<Func<IGrouping<TValue, TResult>, TNewResult>>, AggregateBucketOptions<TValue>)
public static IAggregateFluent<TNewResult> Bucket<TResult, TValue, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TValue>> groupBy, IEnumerable<TValue> boundaries, Expression<Func<IGrouping<TValue, TResult>, TNewResult>> output, AggregateBucketOptions<TValue> options = null)
Parameters
aggregate
IAggregateFluent<TResult>
groupBy
Expression<Func<TResult, TValue>>
boundaries
IEnumerable<TValue>
output
Expression<Func<IGrouping<TValue, TResult>, TNewResult>>
options
AggregateBucketOptions<TValue>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TValue
TNewResult
Facet<TResult>(IAggregateFluent<TResult>, params AggregateFacet<TResult>[])
public static IAggregateFluent<AggregateFacetResults> Facet<TResult>(this IAggregateFluent<TResult> aggregate, params AggregateFacet<TResult>[] facets)
Parameters
aggregate
IAggregateFluent<TResult>
facets
AggregateFacet<TResult>[]
Returns
- IAggregateFluent<AggregateFacetResults>
Type Parameters
TResult
Facet<TResult>(IAggregateFluent<TResult>, IEnumerable<AggregateFacet<TResult>>)
public static IAggregateFluent<AggregateFacetResults> Facet<TResult>(this IAggregateFluent<TResult> aggregate, IEnumerable<AggregateFacet<TResult>> facets)
Parameters
aggregate
IAggregateFluent<TResult>
facets
IEnumerable<AggregateFacet<TResult>>
Returns
- IAggregateFluent<AggregateFacetResults>
Type Parameters
TResult
Facet<TResult, TNewResult>(IAggregateFluent<TResult>, params AggregateFacet<TResult>[])
public static IAggregateFluent<TNewResult> Facet<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, params AggregateFacet<TResult>[] facets)
Parameters
aggregate
IAggregateFluent<TResult>
facets
AggregateFacet<TResult>[]
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TNewResult
FirstAsync<TResult>(IAggregateFluent<TResult>, CancellationToken)
public static Task<TResult> FirstAsync<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)
Parameters
aggregate
IAggregateFluent<TResult>
cancellationToken
CancellationToken
Returns
- Task<TResult>
Type Parameters
TResult
FirstOrDefaultAsync<TResult>(IAggregateFluent<TResult>, CancellationToken)
public static Task<TResult> FirstOrDefaultAsync<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)
Parameters
aggregate
IAggregateFluent<TResult>
cancellationToken
CancellationToken
Returns
- Task<TResult>
Type Parameters
TResult
FirstOrDefault<TResult>(IAggregateFluent<TResult>, CancellationToken)
public static TResult FirstOrDefault<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)
Parameters
aggregate
IAggregateFluent<TResult>
cancellationToken
CancellationToken
Returns
- TResult
Type Parameters
TResult
First<TResult>(IAggregateFluent<TResult>, CancellationToken)
public static TResult First<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)
Parameters
aggregate
IAggregateFluent<TResult>
cancellationToken
CancellationToken
Returns
- TResult
Type Parameters
TResult
GraphLookup<TResult, TFrom>(IAggregateFluent<TResult>, IMongoCollection<TFrom>, FieldDefinition<TFrom, BsonValue>, FieldDefinition<TFrom, BsonValue>, AggregateExpressionDefinition<TResult, BsonValue>, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>>, FieldDefinition<BsonDocument, int>)
public static IAggregateFluent<BsonDocument> GraphLookup<TResult, TFrom>(this IAggregateFluent<TResult> aggregate, IMongoCollection<TFrom> from, FieldDefinition<TFrom, BsonValue> connectFromField, FieldDefinition<TFrom, BsonValue> connectToField, AggregateExpressionDefinition<TResult, BsonValue> startWith, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>> @as, FieldDefinition<BsonDocument, int> depthField = null)
Parameters
aggregate
IAggregateFluent<TResult>
from
IMongoCollection<TFrom>
connectFromField
FieldDefinition<TFrom, BsonValue>
connectToField
FieldDefinition<TFrom, BsonValue>
startWith
AggregateExpressionDefinition<TResult, BsonValue>
as
FieldDefinition<BsonDocument, IEnumerable<BsonDocument>>
depthField
FieldDefinition<BsonDocument, int>
Returns
- IAggregateFluent<BsonDocument>
Type Parameters
TResult
TFrom
GraphLookup<TResult, TFrom, TConnectFrom, TConnectTo, TStartWith, TAs, TNewResult>(IAggregateFluent<TResult>, IMongoCollection<TFrom>, FieldDefinition<TFrom, TConnectFrom>, FieldDefinition<TFrom, TConnectTo>, AggregateExpressionDefinition<TResult, TStartWith>, FieldDefinition<TNewResult, TAs>, AggregateGraphLookupOptions<TFrom, TFrom, TNewResult>)
public static IAggregateFluent<TNewResult> GraphLookup<TResult, TFrom, TConnectFrom, TConnectTo, TStartWith, TAs, TNewResult>(this IAggregateFluent<TResult> aggregate, IMongoCollection<TFrom> from, FieldDefinition<TFrom, TConnectFrom> connectFromField, FieldDefinition<TFrom, TConnectTo> connectToField, AggregateExpressionDefinition<TResult, TStartWith> startWith, FieldDefinition<TNewResult, TAs> @as, AggregateGraphLookupOptions<TFrom, TFrom, TNewResult> options = null) where TAs : IEnumerable<TFrom>
Parameters
aggregate
IAggregateFluent<TResult>
from
IMongoCollection<TFrom>
connectFromField
FieldDefinition<TFrom, TConnectFrom>
connectToField
FieldDefinition<TFrom, TConnectTo>
startWith
AggregateExpressionDefinition<TResult, TStartWith>
as
FieldDefinition<TNewResult, TAs>
options
AggregateGraphLookupOptions<TFrom, TFrom, TNewResult>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TFrom
TConnectFrom
TConnectTo
TStartWith
TAs
TNewResult
GraphLookup<TResult, TFrom, TConnectFrom, TConnectTo, TStartWith, TAs, TNewResult>(IAggregateFluent<TResult>, IMongoCollection<TFrom>, Expression<Func<TFrom, TConnectFrom>>, Expression<Func<TFrom, TConnectTo>>, Expression<Func<TResult, TStartWith>>, Expression<Func<TNewResult, TAs>>, AggregateGraphLookupOptions<TFrom, TFrom, TNewResult>)
public static IAggregateFluent<TNewResult> GraphLookup<TResult, TFrom, TConnectFrom, TConnectTo, TStartWith, TAs, TNewResult>(this IAggregateFluent<TResult> aggregate, IMongoCollection<TFrom> from, Expression<Func<TFrom, TConnectFrom>> connectFromField, Expression<Func<TFrom, TConnectTo>> connectToField, Expression<Func<TResult, TStartWith>> startWith, Expression<Func<TNewResult, TAs>> @as, AggregateGraphLookupOptions<TFrom, TFrom, TNewResult> options = null) where TAs : IEnumerable<TFrom>
Parameters
aggregate
IAggregateFluent<TResult>
from
IMongoCollection<TFrom>
connectFromField
Expression<Func<TFrom, TConnectFrom>>
connectToField
Expression<Func<TFrom, TConnectTo>>
startWith
Expression<Func<TResult, TStartWith>>
as
Expression<Func<TNewResult, TAs>>
options
AggregateGraphLookupOptions<TFrom, TFrom, TNewResult>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TFrom
TConnectFrom
TConnectTo
TStartWith
TAs
TNewResult
GraphLookup<TResult, TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TNewResult>(IAggregateFluent<TResult>, IMongoCollection<TFrom>, Expression<Func<TFrom, TConnectFrom>>, Expression<Func<TFrom, TConnectTo>>, Expression<Func<TResult, TStartWith>>, Expression<Func<TNewResult, TAs>>, Expression<Func<TAsElement, int>>, AggregateGraphLookupOptions<TFrom, TAsElement, TNewResult>)
public static IAggregateFluent<TNewResult> GraphLookup<TResult, TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TNewResult>(this IAggregateFluent<TResult> aggregate, IMongoCollection<TFrom> from, Expression<Func<TFrom, TConnectFrom>> connectFromField, Expression<Func<TFrom, TConnectTo>> connectToField, Expression<Func<TResult, TStartWith>> startWith, Expression<Func<TNewResult, TAs>> @as, Expression<Func<TAsElement, int>> depthField, AggregateGraphLookupOptions<TFrom, TAsElement, TNewResult> options = null) where TAs : IEnumerable<TAsElement>
Parameters
aggregate
IAggregateFluent<TResult>
from
IMongoCollection<TFrom>
connectFromField
Expression<Func<TFrom, TConnectFrom>>
connectToField
Expression<Func<TFrom, TConnectTo>>
startWith
Expression<Func<TResult, TStartWith>>
as
Expression<Func<TNewResult, TAs>>
depthField
Expression<Func<TAsElement, int>>
options
AggregateGraphLookupOptions<TFrom, TAsElement, TNewResult>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TFrom
TConnectFrom
TConnectTo
TStartWith
TAsElement
TAs
TNewResult
Group<TResult>(IAggregateFluent<TResult>, ProjectionDefinition<TResult, BsonDocument>)
public static IAggregateFluent<BsonDocument> Group<TResult>(this IAggregateFluent<TResult> aggregate, ProjectionDefinition<TResult, BsonDocument> group)
Parameters
aggregate
IAggregateFluent<TResult>
group
ProjectionDefinition<TResult, BsonDocument>
Returns
- IAggregateFluent<BsonDocument>
Type Parameters
TResult
Group<TResult, TKey, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TKey>>, Expression<Func<IGrouping<TKey, TResult>, TNewResult>>)
public static IAggregateFluent<TNewResult> Group<TResult, TKey, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TKey>> id, Expression<Func<IGrouping<TKey, TResult>, TNewResult>> group)
Parameters
aggregate
IAggregateFluent<TResult>
id
Expression<Func<TResult, TKey>>
group
Expression<Func<IGrouping<TKey, TResult>, TNewResult>>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TKey
TNewResult
Lookup<TResult>(IAggregateFluent<TResult>, string, FieldDefinition<TResult>, FieldDefinition<BsonDocument>, FieldDefinition<BsonDocument>)
public static IAggregateFluent<BsonDocument> Lookup<TResult>(this IAggregateFluent<TResult> aggregate, string foreignCollectionName, FieldDefinition<TResult> localField, FieldDefinition<BsonDocument> foreignField, FieldDefinition<BsonDocument> @as)
Parameters
aggregate
IAggregateFluent<TResult>
foreignCollectionName
string
localField
FieldDefinition<TResult>
foreignField
FieldDefinition<BsonDocument>
as
FieldDefinition<BsonDocument>
Returns
- IAggregateFluent<BsonDocument>
Type Parameters
TResult
Lookup<TResult, TForeignDocument, TNewResult>(IAggregateFluent<TResult>, IMongoCollection<TForeignDocument>, Expression<Func<TResult, object>>, Expression<Func<TForeignDocument, object>>, Expression<Func<TNewResult, object>>, AggregateLookupOptions<TForeignDocument, TNewResult>)
public static IAggregateFluent<TNewResult> Lookup<TResult, TForeignDocument, TNewResult>(this IAggregateFluent<TResult> aggregate, IMongoCollection<TForeignDocument> foreignCollection, Expression<Func<TResult, object>> localField, Expression<Func<TForeignDocument, object>> foreignField, Expression<Func<TNewResult, object>> @as, AggregateLookupOptions<TForeignDocument, TNewResult> options = null)
Parameters
aggregate
IAggregateFluent<TResult>
foreignCollection
IMongoCollection<TForeignDocument>
localField
Expression<Func<TResult, object>>
foreignField
Expression<Func<TForeignDocument, object>>
as
Expression<Func<TNewResult, object>>
options
AggregateLookupOptions<TForeignDocument, TNewResult>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TForeignDocument
TNewResult
Match<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, bool>>)
public static IAggregateFluent<TResult> Match<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, bool>> filter)
Parameters
aggregate
IAggregateFluent<TResult>
filter
Expression<Func<TResult, bool>>
Returns
- IAggregateFluent<TResult>
Type Parameters
TResult
Project<TResult>(IAggregateFluent<TResult>, ProjectionDefinition<TResult, BsonDocument>)
public static IAggregateFluent<BsonDocument> Project<TResult>(this IAggregateFluent<TResult> aggregate, ProjectionDefinition<TResult, BsonDocument> projection)
Parameters
aggregate
IAggregateFluent<TResult>
projection
ProjectionDefinition<TResult, BsonDocument>
Returns
- IAggregateFluent<BsonDocument>
Type Parameters
TResult
Project<TResult, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TNewResult>>)
public static IAggregateFluent<TNewResult> Project<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TNewResult>> projection)
Parameters
aggregate
IAggregateFluent<TResult>
projection
Expression<Func<TResult, TNewResult>>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TNewResult
ReplaceRoot<TResult, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TNewResult>>)
public static IAggregateFluent<TNewResult> ReplaceRoot<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TNewResult>> newRoot)
Parameters
aggregate
IAggregateFluent<TResult>
newRoot
Expression<Func<TResult, TNewResult>>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TNewResult
SingleAsync<TResult>(IAggregateFluent<TResult>, CancellationToken)
public static Task<TResult> SingleAsync<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)
Parameters
aggregate
IAggregateFluent<TResult>
cancellationToken
CancellationToken
Returns
- Task<TResult>
Type Parameters
TResult
SingleOrDefaultAsync<TResult>(IAggregateFluent<TResult>, CancellationToken)
public static Task<TResult> SingleOrDefaultAsync<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)
Parameters
aggregate
IAggregateFluent<TResult>
cancellationToken
CancellationToken
Returns
- Task<TResult>
Type Parameters
TResult
SingleOrDefault<TResult>(IAggregateFluent<TResult>, CancellationToken)
public static TResult SingleOrDefault<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)
Parameters
aggregate
IAggregateFluent<TResult>
cancellationToken
CancellationToken
Returns
- TResult
Type Parameters
TResult
Single<TResult>(IAggregateFluent<TResult>, CancellationToken)
public static TResult Single<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)
Parameters
aggregate
IAggregateFluent<TResult>
cancellationToken
CancellationToken
Returns
- TResult
Type Parameters
TResult
SortByCount<TResult, TKey>(IAggregateFluent<TResult>, Expression<Func<TResult, TKey>>)
public static IAggregateFluent<AggregateSortByCountResult<TKey>> SortByCount<TResult, TKey>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TKey>> id)
Parameters
aggregate
IAggregateFluent<TResult>
id
Expression<Func<TResult, TKey>>
Returns
- IAggregateFluent<AggregateSortByCountResult<TKey>>
Type Parameters
TResult
TKey
SortByDescending<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>)
public static IOrderedAggregateFluent<TResult> SortByDescending<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)
Parameters
aggregate
IAggregateFluent<TResult>
field
Expression<Func<TResult, object>>
Returns
- IOrderedAggregateFluent<TResult>
Type Parameters
TResult
SortBy<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>)
public static IOrderedAggregateFluent<TResult> SortBy<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)
Parameters
aggregate
IAggregateFluent<TResult>
field
Expression<Func<TResult, object>>
Returns
- IOrderedAggregateFluent<TResult>
Type Parameters
TResult
ThenByDescending<TResult>(IOrderedAggregateFluent<TResult>, Expression<Func<TResult, object>>)
public static IOrderedAggregateFluent<TResult> ThenByDescending<TResult>(this IOrderedAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)
Parameters
aggregate
IOrderedAggregateFluent<TResult>
field
Expression<Func<TResult, object>>
Returns
- IOrderedAggregateFluent<TResult>
Type Parameters
TResult
ThenBy<TResult>(IOrderedAggregateFluent<TResult>, Expression<Func<TResult, object>>)
public static IOrderedAggregateFluent<TResult> ThenBy<TResult>(this IOrderedAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)
Parameters
aggregate
IOrderedAggregateFluent<TResult>
field
Expression<Func<TResult, object>>
Returns
- IOrderedAggregateFluent<TResult>
Type Parameters
TResult
Unwind<TResult>(IAggregateFluent<TResult>, FieldDefinition<TResult>)
public static IAggregateFluent<BsonDocument> Unwind<TResult>(this IAggregateFluent<TResult> aggregate, FieldDefinition<TResult> field)
Parameters
aggregate
IAggregateFluent<TResult>
field
FieldDefinition<TResult>
Returns
- IAggregateFluent<BsonDocument>
Type Parameters
TResult
Unwind<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>)
public static IAggregateFluent<BsonDocument> Unwind<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)
Parameters
aggregate
IAggregateFluent<TResult>
field
Expression<Func<TResult, object>>
Returns
- IAggregateFluent<BsonDocument>
Type Parameters
TResult
Unwind<TResult, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>, IBsonSerializer<TNewResult>)
[Obsolete("Use the Unwind overload which takes an options parameter.")]
public static IAggregateFluent<TNewResult> Unwind<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field, IBsonSerializer<TNewResult> newResultSerializer)
Parameters
aggregate
IAggregateFluent<TResult>
field
Expression<Func<TResult, object>>
newResultSerializer
IBsonSerializer<TNewResult>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TNewResult
Unwind<TResult, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>, AggregateUnwindOptions<TNewResult>)
public static IAggregateFluent<TNewResult> Unwind<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field, AggregateUnwindOptions<TNewResult> options = null)
Parameters
aggregate
IAggregateFluent<TResult>
field
Expression<Func<TResult, object>>
options
AggregateUnwindOptions<TNewResult>
Returns
- IAggregateFluent<TNewResult>
Type Parameters
TResult
TNewResult