Class IAggregateFluentExtensions
Extension methods for IAggregateFluent<TResult>
public static class IAggregateFluentExtensions- Inheritance
- 
      
      IAggregateFluentExtensions
- Inherited Members
Methods
BucketAutoForLinq2<TResult, TValue, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, int, Expression<Func<IGrouping<TValue, TResult>, TNewResult>>, AggregateBucketAutoOptions)
Appends a $bucketAuto stage to the pipeline (this method can only be used with LINQ2).
public static IAggregateFluent<TNewResult> BucketAutoForLinq2<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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- groupByExpression<Func<TResult, TValue>>
- The expression providing the value to group by. 
- bucketsint
- The number of buckets. 
- outputExpression<Func<IGrouping<TValue, TResult>, TNewResult>>
- The output projection. 
- optionsAggregateBucketAutoOptions
- The options (optional). 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TValue
- The type of the value. 
- TNewResult
- The type of the new result. 
BucketAuto<TResult, TValue>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, int, AggregateBucketAutoOptions)
Appends a $bucketAuto stage to the pipeline.
public static IAggregateFluent<AggregateBucketAutoResult<TValue>> BucketAuto<TResult, TValue>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TValue>> groupBy, int buckets, AggregateBucketAutoOptions options = null)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- groupByExpression<Func<TResult, TValue>>
- The expression providing the value to group by. 
- bucketsint
- The number of buckets. 
- optionsAggregateBucketAutoOptions
- The options (optional). 
Returns
- IAggregateFluent<AggregateBucketAutoResult<TValue>>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TValue
- The type of the value. 
BucketAuto<TResult, TValue, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, int, Expression<Func<IGrouping<AggregateBucketAutoResultId<TValue>, TResult>, TNewResult>>, AggregateBucketAutoOptions)
Appends a $bucketAuto stage to the pipeline (this overload can only be used with LINQ3).
public static IAggregateFluent<TNewResult> BucketAuto<TResult, TValue, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TValue>> groupBy, int buckets, Expression<Func<IGrouping<AggregateBucketAutoResultId<TValue>, TResult>, TNewResult>> output, AggregateBucketAutoOptions options = null)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- groupByExpression<Func<TResult, TValue>>
- The expression providing the value to group by. 
- bucketsint
- The number of buckets. 
- outputExpression<Func<IGrouping<AggregateBucketAutoResultId<TValue>, TResult>, TNewResult>>
- The output projection. 
- optionsAggregateBucketAutoOptions
- The options (optional). 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TValue
- The type of the value. 
- TNewResult
- The type of the new result. 
Bucket<TResult, TValue>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, IEnumerable<TValue>, AggregateBucketOptions<TValue>)
Appends a $bucket stage to the pipeline.
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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- groupByExpression<Func<TResult, TValue>>
- The expression providing the value to group by. 
- boundariesIEnumerable<TValue>
- The bucket boundaries. 
- optionsAggregateBucketOptions<TValue>
- The options. 
Returns
- IAggregateFluent<AggregateBucketResult<TValue>>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TValue
- The type of the value. 
Bucket<TResult, TValue, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TValue>>, IEnumerable<TValue>, Expression<Func<IGrouping<TValue, TResult>, TNewResult>>, AggregateBucketOptions<TValue>)
Appends a $bucket stage to the pipeline.
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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- groupByExpression<Func<TResult, TValue>>
- The expression providing the value to group by. 
- boundariesIEnumerable<TValue>
- The bucket boundaries. 
- outputExpression<Func<IGrouping<TValue, TResult>, TNewResult>>
- The output projection. 
- optionsAggregateBucketOptions<TValue>
- The options. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TValue
- The type of the value. 
- TNewResult
- The type of the new result. 
Densify<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>, DensifyRange, IEnumerable<Expression<Func<TResult, object>>>)
Appends a $densify stage to the pipeline.
public static IAggregateFluent<TResult> Densify<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field, DensifyRange range, IEnumerable<Expression<Func<TResult, object>>> partitionByFields = null)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field. 
- rangeDensifyRange
- The range. 
- partitionByFieldsIEnumerable<Expression<Func<TResult, object>>>
- The partition by fields. 
Returns
- IAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Densify<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>, DensifyRange, params Expression<Func<TResult, object>>[])
Appends a $densify stage to the pipeline.
public static IAggregateFluent<TResult> Densify<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field, DensifyRange range, params Expression<Func<TResult, object>>[] partitionByFields)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field. 
- rangeDensifyRange
- The range. 
- partitionByFieldsExpression<Func<TResult, object>>[]
- The partition by fields. 
Returns
- IAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Documents<TResult>(IAggregateFluent<NoPipelineInput>, AggregateExpressionDefinition<NoPipelineInput, IEnumerable<TResult>>, IBsonSerializer<TResult>)
Appends a $documents stage to the pipeline.
public static IAggregateFluent<TResult> Documents<TResult>(this IAggregateFluent<NoPipelineInput> aggregate, AggregateExpressionDefinition<NoPipelineInput, IEnumerable<TResult>> documents, IBsonSerializer<TResult> documentSerializer = null)Parameters
- aggregateIAggregateFluent<NoPipelineInput>
- The aggregate. 
- documentsAggregateExpressionDefinition<NoPipelineInput, IEnumerable<TResult>>
- The documents. 
- documentSerializerIBsonSerializer<TResult>
- The document serializer. 
Returns
- IAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Documents<TResult>(IAggregateFluent<NoPipelineInput>, IEnumerable<TResult>, IBsonSerializer<TResult>)
Appends a $documents stage to the pipeline.
public static IAggregateFluent<TResult> Documents<TResult>(this IAggregateFluent<NoPipelineInput> aggregate, IEnumerable<TResult> documents, IBsonSerializer<TResult> documentSerializer = null)Parameters
- aggregateIAggregateFluent<NoPipelineInput>
- The aggregate. 
- documentsIEnumerable<TResult>
- The documents. 
- documentSerializerIBsonSerializer<TResult>
- The document serializer. 
Returns
- IAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Facet<TResult>(IAggregateFluent<TResult>, params AggregateFacet<TResult>[])
Appends a $facet stage to the pipeline.
public static IAggregateFluent<AggregateFacetResults> Facet<TResult>(this IAggregateFluent<TResult> aggregate, params AggregateFacet<TResult>[] facets)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- facetsAggregateFacet<TResult>[]
- The facets. 
Returns
- IAggregateFluent<AggregateFacetResults>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Facet<TResult>(IAggregateFluent<TResult>, IEnumerable<AggregateFacet<TResult>>)
Appends a $facet stage to the pipeline.
public static IAggregateFluent<AggregateFacetResults> Facet<TResult>(this IAggregateFluent<TResult> aggregate, IEnumerable<AggregateFacet<TResult>> facets)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- facetsIEnumerable<AggregateFacet<TResult>>
- The facets. 
Returns
- IAggregateFluent<AggregateFacetResults>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Facet<TResult, TNewResult>(IAggregateFluent<TResult>, params AggregateFacet<TResult>[])
Appends a $facet stage to the pipeline.
public static IAggregateFluent<TNewResult> Facet<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, params AggregateFacet<TResult>[] facets)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- facetsAggregateFacet<TResult>[]
- The facets. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TNewResult
- The type of the new result. 
FirstAsync<TResult>(IAggregateFluent<TResult>, CancellationToken)
Returns the first document of the aggregate result.
public static Task<TResult> FirstAsync<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- cancellationTokenCancellationToken
- The cancellation token. 
Returns
- Task<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
FirstOrDefaultAsync<TResult>(IAggregateFluent<TResult>, CancellationToken)
Returns the first document of the aggregate result, or the default value if the result set is empty.
public static Task<TResult> FirstOrDefaultAsync<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- cancellationTokenCancellationToken
- The cancellation token. 
Returns
- Task<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
FirstOrDefault<TResult>(IAggregateFluent<TResult>, CancellationToken)
Returns the first document of the aggregate result, or the default value if the result set is empty.
public static TResult FirstOrDefault<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- cancellationTokenCancellationToken
- The cancellation token. 
Returns
- TResult
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
First<TResult>(IAggregateFluent<TResult>, CancellationToken)
Returns the first document of the aggregate result.
public static TResult First<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- cancellationTokenCancellationToken
- The cancellation token. 
Returns
- TResult
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
GraphLookup<TResult, TFrom>(IAggregateFluent<TResult>, IMongoCollection<TFrom>, FieldDefinition<TFrom, BsonValue>, FieldDefinition<TFrom, BsonValue>, AggregateExpressionDefinition<TResult, BsonValue>, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>>, FieldDefinition<BsonDocument, int>)
Appends a $graphLookup stage to the pipeline.
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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fromIMongoCollection<TFrom>
- The from collection. 
- connectFromFieldFieldDefinition<TFrom, BsonValue>
- The connect from field. 
- connectToFieldFieldDefinition<TFrom, BsonValue>
- The connect to field. 
- startWithAggregateExpressionDefinition<TResult, BsonValue>
- The start with value. 
- asFieldDefinition<BsonDocument, IEnumerable<BsonDocument>>
- The as field. 
- depthFieldFieldDefinition<BsonDocument, int>
- The depth field. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TFrom
- The type of the from documents. 
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>)
Appends a $graphLookup stage to the pipeline.
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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fromIMongoCollection<TFrom>
- The from collection. 
- connectFromFieldFieldDefinition<TFrom, TConnectFrom>
- The connect from field. 
- connectToFieldFieldDefinition<TFrom, TConnectTo>
- The connect to field. 
- startWithAggregateExpressionDefinition<TResult, TStartWith>
- The start with value. 
- asFieldDefinition<TNewResult, TAs>
- The as field. 
- optionsAggregateGraphLookupOptions<TFrom, TFrom, TNewResult>
- The options. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TFrom
- The type of the from documents. 
- TConnectFrom
- The type of the connect from field (must be either TConnectTo or a type that implements IEnumerable{TConnectTo}). 
- TConnectTo
- The type of the connect to field. 
- TStartWith
- The type of the start with expression (must be either TConnectTo or a type that implements IEnumerable{TConnectTo}). 
- TAs
- The type of the as field. 
- TNewResult
- The type of the new result (must be same as TResult with an additional as field). 
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>)
Appends a $graphLookup stage to the pipeline.
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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fromIMongoCollection<TFrom>
- The from collection. 
- connectFromFieldExpression<Func<TFrom, TConnectFrom>>
- The connect from field. 
- connectToFieldExpression<Func<TFrom, TConnectTo>>
- The connect to field. 
- startWithExpression<Func<TResult, TStartWith>>
- The start with value. 
- asExpression<Func<TNewResult, TAs>>
- The as field. 
- optionsAggregateGraphLookupOptions<TFrom, TFrom, TNewResult>
- The options. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TFrom
- The type of the from documents. 
- TConnectFrom
- The type of the connect from field (must be either TConnectTo or a type that implements IEnumerable{TConnectTo}). 
- TConnectTo
- The type of the connect to field. 
- TStartWith
- The type of the start with expression (must be either TConnectTo or a type that implements IEnumerable{TConnectTo}). 
- TAs
- The type of the as field. 
- TNewResult
- The type of the new result (must be same as TResult with an additional as field). 
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>)
Appends a $graphLookup stage to the pipeline.
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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fromIMongoCollection<TFrom>
- The from collection. 
- connectFromFieldExpression<Func<TFrom, TConnectFrom>>
- The connect from field. 
- connectToFieldExpression<Func<TFrom, TConnectTo>>
- The connect to field. 
- startWithExpression<Func<TResult, TStartWith>>
- The start with value. 
- asExpression<Func<TNewResult, TAs>>
- The as field. 
- depthFieldExpression<Func<TAsElement, int>>
- The depth field. 
- optionsAggregateGraphLookupOptions<TFrom, TAsElement, TNewResult>
- The options. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TFrom
- The type of the from documents. 
- TConnectFrom
- The type of the connect from field (must be either TConnectTo or a type that implements IEnumerable{TConnectTo}). 
- TConnectTo
- The type of the connect to field. 
- TStartWith
- The type of the start with expression (must be either TConnectTo or a type that implements IEnumerable{TConnectTo}). 
- TAsElement
- The type of the as field elements. 
- TAs
- The type of the as field. 
- TNewResult
- The type of the new result (must be same as TResult with an additional as field). 
Group<TResult>(IAggregateFluent<TResult>, ProjectionDefinition<TResult, BsonDocument>)
Appends a group stage to the pipeline.
public static IAggregateFluent<BsonDocument> Group<TResult>(this IAggregateFluent<TResult> aggregate, ProjectionDefinition<TResult, BsonDocument> group)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- groupProjectionDefinition<TResult, BsonDocument>
- The group projection. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Group<TResult, TKey, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TKey>>, Expression<Func<IGrouping<TKey, TResult>, TNewResult>>)
Appends a group stage to the pipeline.
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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- idExpression<Func<TResult, TKey>>
- The id. 
- groupExpression<Func<IGrouping<TKey, TResult>, TNewResult>>
- The group projection. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TKey
- The type of the key. 
- TNewResult
- The type of the new result. 
Lookup<TResult>(IAggregateFluent<TResult>, IMongoCollection<BsonDocument>, BsonDocument, PipelineDefinition<BsonDocument, BsonDocument>, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>>)
Appends a lookup stage to the pipeline.
public static IAggregateFluent<BsonDocument> Lookup<TResult>(this IAggregateFluent<TResult> aggregate, IMongoCollection<BsonDocument> foreignCollection, BsonDocument let, PipelineDefinition<BsonDocument, BsonDocument> lookupPipeline, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>> @as)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- foreignCollectionIMongoCollection<BsonDocument>
- The foreign collection. 
- letBsonDocument
- The "let" definition. 
- lookupPipelinePipelineDefinition<BsonDocument, BsonDocument>
- The lookup pipeline. 
- asFieldDefinition<BsonDocument, IEnumerable<BsonDocument>>
- The as field in the result in which to place the results of the lookup pipeline. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Lookup<TResult>(IAggregateFluent<TResult>, string, FieldDefinition<TResult>, FieldDefinition<BsonDocument>, FieldDefinition<BsonDocument>)
Appends a lookup stage to the pipeline.
public static IAggregateFluent<BsonDocument> Lookup<TResult>(this IAggregateFluent<TResult> aggregate, string foreignCollectionName, FieldDefinition<TResult> localField, FieldDefinition<BsonDocument> foreignField, FieldDefinition<BsonDocument> @as)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- foreignCollectionNamestring
- Name of the foreign collection. 
- localFieldFieldDefinition<TResult>
- The local field. 
- foreignFieldFieldDefinition<BsonDocument>
- The foreign field. 
- asFieldDefinition<BsonDocument>
- The field in the result to place the foreign matches. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Lookup<TResult, TForeignDocument, TNewResult>(IAggregateFluent<TResult>, IMongoCollection<TForeignDocument>, Expression<Func<TResult, object>>, Expression<Func<TForeignDocument, object>>, Expression<Func<TNewResult, object>>, AggregateLookupOptions<TForeignDocument, TNewResult>)
Appends a lookup stage to the pipeline.
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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- foreignCollectionIMongoCollection<TForeignDocument>
- The foreign collection. 
- localFieldExpression<Func<TResult, object>>
- The local field. 
- foreignFieldExpression<Func<TForeignDocument, object>>
- The foreign field. 
- asExpression<Func<TNewResult, object>>
- The field in the result to place the foreign matches. 
- optionsAggregateLookupOptions<TForeignDocument, TNewResult>
- The options. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TForeignDocument
- The type of the foreign collection. 
- TNewResult
- The type of the new result. 
Lookup<TResult, TForeignDocument, TAsElement, TAs, TNewResult>(IAggregateFluent<TResult>, IMongoCollection<TForeignDocument>, BsonDocument, PipelineDefinition<TForeignDocument, TAsElement>, Expression<Func<TNewResult, TAs>>, AggregateLookupOptions<TForeignDocument, TNewResult>)
Appends a lookup stage to the pipeline.
public static IAggregateFluent<TNewResult> Lookup<TResult, TForeignDocument, TAsElement, TAs, TNewResult>(this IAggregateFluent<TResult> aggregate, IMongoCollection<TForeignDocument> foreignCollection, BsonDocument let, PipelineDefinition<TForeignDocument, TAsElement> lookupPipeline, Expression<Func<TNewResult, TAs>> @as, AggregateLookupOptions<TForeignDocument, TNewResult> options = null) where TAs : IEnumerable<TAsElement>Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- foreignCollectionIMongoCollection<TForeignDocument>
- The foreign collection. 
- letBsonDocument
- The "let" definition. 
- lookupPipelinePipelineDefinition<TForeignDocument, TAsElement>
- The lookup pipeline. 
- asExpression<Func<TNewResult, TAs>>
- The as field in - TNewResultin which to place the results of the lookup pipeline.
- optionsAggregateLookupOptions<TForeignDocument, TNewResult>
- The options. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TForeignDocument
- The type of the foreign collection documents. 
- TAsElement
- The type of the as field elements. 
- TAs
- The type of the as field. 
- TNewResult
- The type of the new result. 
Match<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, bool>>)
Appends a match stage to the pipeline.
public static IAggregateFluent<TResult> Match<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, bool>> filter)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- filterExpression<Func<TResult, bool>>
- The filter. 
Returns
- IAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Project<TResult>(IAggregateFluent<TResult>, ProjectionDefinition<TResult, BsonDocument>)
Appends a project stage to the pipeline.
public static IAggregateFluent<BsonDocument> Project<TResult>(this IAggregateFluent<TResult> aggregate, ProjectionDefinition<TResult, BsonDocument> projection)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- projectionProjectionDefinition<TResult, BsonDocument>
- The projection. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Project<TResult, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TNewResult>>)
Appends a project stage to the pipeline.
public static IAggregateFluent<TNewResult> Project<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TNewResult>> projection)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- projectionExpression<Func<TResult, TNewResult>>
- The projection. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TNewResult
- The type of the new result. 
ReplaceRoot<TResult, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TNewResult>>)
Appends a $replaceRoot stage to the pipeline.
public static IAggregateFluent<TNewResult> ReplaceRoot<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TNewResult>> newRoot)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- newRootExpression<Func<TResult, TNewResult>>
- The new root. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TNewResult
- The type of the new result. 
ReplaceWith<TResult, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, TNewResult>>)
Appends a $replaceWith stage to the pipeline.
public static IAggregateFluent<TNewResult> ReplaceWith<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TNewResult>> newRoot)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- newRootExpression<Func<TResult, TNewResult>>
- The new root. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TNewResult
- The type of the new result. 
SetWindowFields<TResult, TWindowFields>(IAggregateFluent<TResult>, Expression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>>)
Appends a $setWindowFields to the pipeline.
public static IAggregateFluent<BsonDocument> SetWindowFields<TResult, TWindowFields>(this IAggregateFluent<TResult> aggregate, Expression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>> output)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- outputExpression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>>
- The window fields expression. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TWindowFields
- The type of the added window fields. 
SetWindowFields<TResult, TPartitionBy, TWindowFields>(IAggregateFluent<TResult>, Expression<Func<TResult, TPartitionBy>>, SortDefinition<TResult>, Expression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>>)
Appends a $setWindowFields to the pipeline.
public static IAggregateFluent<BsonDocument> SetWindowFields<TResult, TPartitionBy, TWindowFields>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TPartitionBy>> partitionBy, SortDefinition<TResult> sortBy, Expression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>> output)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- partitionByExpression<Func<TResult, TPartitionBy>>
- The partitionBy expression. 
- sortBySortDefinition<TResult>
- The sortBy expression. 
- outputExpression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>>
- The window fields expression. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TPartitionBy
- The type of the value to partition by. 
- TWindowFields
- The type of the added window fields. 
SetWindowFields<TResult, TPartitionBy, TWindowFields>(IAggregateFluent<TResult>, Expression<Func<TResult, TPartitionBy>>, Expression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>>)
Appends a $setWindowFields to the pipeline.
public static IAggregateFluent<BsonDocument> SetWindowFields<TResult, TPartitionBy, TWindowFields>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TPartitionBy>> partitionBy, Expression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>> output)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- partitionByExpression<Func<TResult, TPartitionBy>>
- The partitionBy expression. 
- outputExpression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>>
- The window fields expression. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TPartitionBy
- The type of the value to partition by. 
- TWindowFields
- The type of the added window fields. 
Set<TResult, TFields>(IAggregateFluent<TResult>, Expression<Func<TResult, TFields>>)
Appends a $set stage to the pipeline.
public static IAggregateFluent<TResult> Set<TResult, TFields>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TFields>> fields)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldsExpression<Func<TResult, TFields>>
- The fields to set. 
Returns
- IAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TFields
- The type of object specifying the fields to set. 
SingleAsync<TResult>(IAggregateFluent<TResult>, CancellationToken)
Returns the only document of the aggregate result. Throws an exception if the result set does not contain exactly one document.
public static Task<TResult> SingleAsync<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- cancellationTokenCancellationToken
- The cancellation token. 
Returns
- Task<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
SingleOrDefaultAsync<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 Task<TResult> SingleOrDefaultAsync<TResult>(this IAggregateFluent<TResult> aggregate, CancellationToken cancellationToken = default)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- cancellationTokenCancellationToken
- The cancellation token. 
Returns
- Task<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
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. 
- cancellationTokenCancellationToken
- The cancellation token. 
Returns
- TResult
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Single<TResult>(IAggregateFluent<TResult>, 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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- cancellationTokenCancellationToken
- The cancellation token. 
Returns
- TResult
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
SortByCount<TResult, TKey>(IAggregateFluent<TResult>, Expression<Func<TResult, TKey>>)
Appends a sortByCount stage to the pipeline.
public static IAggregateFluent<AggregateSortByCountResult<TKey>> SortByCount<TResult, TKey>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, TKey>> id)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- idExpression<Func<TResult, TKey>>
- The id. 
Returns
- IAggregateFluent<AggregateSortByCountResult<TKey>>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TKey
- The type of the key. 
SortByDescending<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>)
Appends a descending sort stage to the pipeline.
public static IOrderedAggregateFluent<TResult> SortByDescending<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field to sort by. 
Returns
- IOrderedAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
SortBy<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>)
Appends an ascending sort stage to the pipeline.
public static IOrderedAggregateFluent<TResult> SortBy<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field to sort by. 
Returns
- IOrderedAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
ThenByDescending<TResult>(IOrderedAggregateFluent<TResult>, Expression<Func<TResult, object>>)
Modifies the current sort stage by appending a descending field specification to it.
public static IOrderedAggregateFluent<TResult> ThenByDescending<TResult>(this IOrderedAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)Parameters
- aggregateIOrderedAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field to sort by. 
Returns
- IOrderedAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
ThenBy<TResult>(IOrderedAggregateFluent<TResult>, Expression<Func<TResult, object>>)
Modifies the current sort stage by appending an ascending field specification to it.
public static IOrderedAggregateFluent<TResult> ThenBy<TResult>(this IOrderedAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)Parameters
- aggregateIOrderedAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field to sort by. 
Returns
- IOrderedAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Unwind<TResult>(IAggregateFluent<TResult>, FieldDefinition<TResult>)
Appends an unwind stage to the pipeline.
public static IAggregateFluent<BsonDocument> Unwind<TResult>(this IAggregateFluent<TResult> aggregate, FieldDefinition<TResult> field)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldFieldDefinition<TResult>
- The field to unwind. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Unwind<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>)
Appends an unwind stage to the pipeline.
public static IAggregateFluent<BsonDocument> Unwind<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field to unwind. 
Returns
- IAggregateFluent<BsonDocument>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
Unwind<TResult, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>, IBsonSerializer<TNewResult>)
Appends an unwind stage to the pipeline.
[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
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field to unwind. 
- newResultSerializerIBsonSerializer<TNewResult>
- The new result serializer. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TNewResult
- The type of the new result. 
Unwind<TResult, TNewResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>, AggregateUnwindOptions<TNewResult>)
Appends an unwind stage to the pipeline.
public static IAggregateFluent<TNewResult> Unwind<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field, AggregateUnwindOptions<TNewResult> options = null)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field to unwind. 
- optionsAggregateUnwindOptions<TNewResult>
- The options. 
Returns
- IAggregateFluent<TNewResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result. 
- TNewResult
- The type of the new result. 
VectorSearch<TResult>(IAggregateFluent<TResult>, Expression<Func<TResult, object>>, QueryVector, int, VectorSearchOptions<TResult>)
Appends a $vectorSearch stage.
public static IAggregateFluent<TResult> VectorSearch<TResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, object>> field, QueryVector queryVector, int limit, VectorSearchOptions<TResult> options = null)Parameters
- aggregateIAggregateFluent<TResult>
- The aggregate. 
- fieldExpression<Func<TResult, object>>
- The field. 
- queryVectorQueryVector
- The query vector. 
- limitint
- The limit. 
- optionsVectorSearchOptions<TResult>
- The vector search options. 
Returns
- IAggregateFluent<TResult>
- The fluent aggregate interface. 
Type Parameters
- TResult
- The type of the result.