Click or drag to resize

IAggregateFluent<TResult> Interface

Fluent interface for aggregate.

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.21.0+5a9c3311e158910b88195f290e6d4b1b2715d2b2
Syntax
public interface IAggregateFluent<TResult> : IAsyncCursorSource<TResult>

Type Parameters

TResult
The type of the result of the pipeline.

The IAggregateFluent<TResult> type exposes the following members.

Properties
  NameDescription
Public propertyDatabase
Gets the database.
Public propertyOptions
Gets the options.
Public propertyStages
Gets the stages.
Top
Methods
  NameDescription
Public methodAppendStage<TNewResult>
Appends the stage to the pipeline.
Public methodAs<TNewResult>
Changes the result type of the pipeline.
Public methodBucket<TValue>(AggregateExpressionDefinition<TResult, TValue>, IEnumerable<TValue>, AggregateBucketOptions<TValue>)
Appends a $bucket stage to the pipeline.
Public methodBucket<TValue, TNewResult>(AggregateExpressionDefinition<TResult, TValue>, IEnumerable<TValue>, ProjectionDefinition<TResult, TNewResult>, AggregateBucketOptions<TValue>)
Appends a $bucket stage to the pipeline with a custom projection.
Public methodBucketAuto<TValue>(AggregateExpressionDefinition<TResult, TValue>, Int32, AggregateBucketAutoOptions)
Appends a $bucketAuto stage to the pipeline.
Public methodBucketAuto<TValue, TNewResult>(AggregateExpressionDefinition<TResult, TValue>, Int32, ProjectionDefinition<TResult, TNewResult>, AggregateBucketAutoOptions)
Appends a $bucketAuto stage to the pipeline with a custom projection.
Public methodChangeStream
Appends a $changeStream stage to the pipeline. Normally you would prefer to use the Watch method of IMongoCollection<TDocument>. Only use this method if subsequent stages project away the resume token (the _id) or you don't want the resulting cursor to automatically resume.
Public methodCount
Appends a count stage to the pipeline.
Public methodDensify(FieldDefinition<TResult>, DensifyRange,FieldDefinition<TResult>[])
Appends a $densify stage to the pipeline.
Public methodDensify(FieldDefinition<TResult>, DensifyRange, IEnumerable<FieldDefinition<TResult>>)
Appends a $densify stage to the pipeline.
Public methodFacet<TNewResult>
Appends a $facet stage to the pipeline.
Public methodGraphLookup<TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TNewResult>
Appends a $graphLookup stage to the pipeline.
Public methodGroup<TNewResult>
Appends a group stage to the pipeline.
Public methodLimit
Appends a limit stage to the pipeline.
Public methodLookup<TForeignDocument, TNewResult>(String, FieldDefinition<TResult>, FieldDefinition<TForeignDocument>, FieldDefinition<TNewResult>, AggregateLookupOptions<TForeignDocument, TNewResult>)
Appends a lookup stage to the pipeline.
Public methodLookup<TForeignDocument, TAsElement, TAs, TNewResult>(IMongoCollection<TForeignDocument>, BsonDocument, PipelineDefinition<TForeignDocument, TAsElement>, FieldDefinition<TNewResult, TAs>, AggregateLookupOptions<TForeignDocument, TNewResult>)
Appends a lookup stage to the pipeline.
Public methodMatch
Appends a match stage to the pipeline.
Public methodMerge<TOutput>
Appends a merge stage to the pipeline and executes it, and then returns a cursor to read the contents of the output collection.
Public methodMergeAsync<TOutput>
Appends a merge stage to the pipeline and executes it, and then returns a cursor to read the contents of the output collection.
Public methodOfType<TNewResult>
Appends a match stage to the pipeline that matches derived documents and changes the result type to the derived type.
Public methodOut(String, CancellationToken)
Appends an out stage to the pipeline and executes it, and then returns a cursor to read the contents of the output collection.
Public methodOut(IMongoCollection<TResult>, CancellationToken)
Appends an out stage to the pipeline and executes it, and then returns a cursor to read the contents of the output collection.
Public methodOutAsync(String, CancellationToken)
Appends an out stage to the pipeline and executes it, and then returns a cursor to read the contents of the output collection.
Public methodOutAsync(IMongoCollection<TResult>, CancellationToken)
Appends an out stage to the pipeline and executes it, and then returns a cursor to read the contents of the output collection.
Public methodProject<TNewResult>
Appends a project stage to the pipeline.
Public methodReplaceRoot<TNewResult>
Appends a $replaceRoot stage to the pipeline.
Public methodReplaceWith<TNewResult>
Appends a $replaceWith stage to the pipeline.
Public methodSearch(SearchDefinition<TResult>, SearchOptions<TResult>)
Appends a $search stage to the pipeline.
Public methodSearch(SearchDefinition<TResult>, SearchHighlightOptions<TResult>, String, SearchCountOptions, Boolean, Boolean)
Appends a $search stage to the pipeline.
Public methodSearchMeta
Appends a $searchMeta stage to the pipeline.
Public methodSetWindowFields<TWindowFields>(AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields>)
Appends a $setWindowFields to the pipeline.
Public methodSetWindowFields<TPartitionBy, TWindowFields>(AggregateExpressionDefinition<TResult, TPartitionBy>, AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields>)
Appends a $setWindowFields to the pipeline.
Public methodSetWindowFields<TPartitionBy, TWindowFields>(AggregateExpressionDefinition<TResult, TPartitionBy>, SortDefinition<TResult>, AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields>)
Appends a $setWindowFields to the pipeline.
Public methodSkip
Appends a skip stage to the pipeline.
Public methodSort
Appends a sort stage to the pipeline.
Public methodSortByCount<TId>
Appends a sortByCount stage to the pipeline.
Public methodToCollection
Executes an aggregation pipeline that writes the results to a collection.
Public methodToCollectionAsync
Executes an aggregation pipeline that writes the results to a collection.
Public methodToCursor
Executes the operation and returns a cursor to the results.
(Inherited from IAsyncCursorSource<TDocument>.)
Public methodToCursorAsync
Executes the operation and returns a cursor to the results.
(Inherited from IAsyncCursorSource<TDocument>.)
Public methodUnionWith<TWith>
Appends an $unionWith stage to the pipeline.
Public methodUnwind<TNewResult>(FieldDefinition<TResult>, IBsonSerializer<TNewResult>) Obsolete.
Appends an unwind stage to the pipeline.
Public methodUnwind<TNewResult>(FieldDefinition<TResult>, AggregateUnwindOptions<TNewResult>)
Appends an unwind stage to the pipeline.
Top
Extension Methods
  NameDescription
Public Extension MethodAny<TResult>
Determines whether the cursor returned by a cursor source contains any documents.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodAnyAsync<TResult>
Determines whether the cursor returned by a cursor source contains any documents.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodBucket<TResult, TValue>(Expression<Func<TResult, TValue>>, IEnumerable<TValue>, AggregateBucketOptions<TValue>)Overloaded.
Appends a $bucket stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodBucket<TResult, TValue, TNewResult>(Expression<Func<TResult, TValue>>, IEnumerable<TValue>, Expression<Func<IGrouping<TValue, TResult>, TNewResult>>, AggregateBucketOptions<TValue>)Overloaded.
Appends a $bucket stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodBucketAuto<TResult, TValue>(Expression<Func<TResult, TValue>>, Int32, AggregateBucketAutoOptions)Overloaded.
Appends a $bucketAuto stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodBucketAuto<TResult, TValue, TNewResult>(Expression<Func<TResult, TValue>>, Int32, Expression<Func<IGrouping<AggregateBucketAutoResultId<TValue>, TResult>, TNewResult>>, AggregateBucketAutoOptions)Overloaded.
Appends a $bucketAuto stage to the pipeline (this overload can only be used with LINQ3).
(Defined by IAggregateFluentExtensions.)
Public Extension MethodBucketAutoForLinq2<TResult, TValue, TNewResult>
Appends a $bucketAuto stage to the pipeline (this method can only be used with LINQ2).
(Defined by IAggregateFluentExtensions.)
Public Extension MethodDensify<TResult>(Expression<Func<TResult, Object>>, DensifyRange, IEnumerable<Expression<Func<TResult, Object>>>)Overloaded.
Appends a $densify stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodDensify<TResult>(Expression<Func<TResult, Object>>, DensifyRange,Expression<Func<TResult, Object>>[])Overloaded.
Appends a $densify stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodFacet<TResult>(IEnumerable<AggregateFacet<TResult>>)Overloaded.
Appends a $facet stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodFacet<TResult>(AggregateFacet<TResult>[])Overloaded.
Appends a $facet stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodFacet<TResult, TNewResult>(AggregateFacet<TResult>[])Overloaded.
Appends a $facet stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodFirst<TResult>(CancellationToken)Overloaded.
Returns the first document of a cursor returned by a cursor source.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodFirst<TResult>(CancellationToken)Overloaded.
Returns the first document of the aggregate result.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodFirstAsync<TResult>(CancellationToken)Overloaded.
Returns the first document of a cursor returned by a cursor source.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodFirstAsync<TResult>(CancellationToken)Overloaded.
Returns the first document of the aggregate result.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodFirstOrDefault<TResult>(CancellationToken)Overloaded.
Returns the first document of a cursor returned by a cursor source, or a default value if the cursor contains no documents.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodFirstOrDefault<TResult>(CancellationToken)Overloaded.
Returns the first document of the aggregate result, or the default value if the result set is empty.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodFirstOrDefaultAsync<TResult>(CancellationToken)Overloaded.
Returns the first document of a cursor returned by a cursor source, or a default value if the cursor contains no documents.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodFirstOrDefaultAsync<TResult>(CancellationToken)Overloaded.
Returns the first document of the aggregate result, or the default value if the result set is empty.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodForEachAsync<TResult>(Func<TResult, Task>, CancellationToken)Overloaded.
Calls a delegate for each document returned by the cursor.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodForEachAsync<TResult>(Func<TResult, Int32, Task>, CancellationToken)Overloaded.
Calls a delegate for each document returned by the cursor.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodForEachAsync<TResult>(Action<TResult>, CancellationToken)Overloaded.
Calls a delegate for each document returned by the cursor.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodForEachAsync<TResult>(Action<TResult, Int32>, CancellationToken)Overloaded.
Calls a delegate for each document returned by the cursor.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodGraphLookup<TResult, TFrom>(IMongoCollection<TFrom>, FieldDefinition<TFrom, BsonValue>, FieldDefinition<TFrom, BsonValue>, AggregateExpressionDefinition<TResult, BsonValue>, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>>, FieldDefinition<BsonDocument, Int32>)Overloaded.
Appends a $graphLookup stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodGraphLookup<TResult, TFrom, TConnectFrom, TConnectTo, TStartWith, TAs, TNewResult>(IMongoCollection<TFrom>, FieldDefinition<TFrom, TConnectFrom>, FieldDefinition<TFrom, TConnectTo>, AggregateExpressionDefinition<TResult, TStartWith>, FieldDefinition<TNewResult, TAs>, AggregateGraphLookupOptions<TFrom, TFrom, TNewResult>)Overloaded.
Appends a $graphLookup stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodGraphLookup<TResult, TFrom, TConnectFrom, TConnectTo, TStartWith, TAs, TNewResult>(IMongoCollection<TFrom>, Expression<Func<TFrom, TConnectFrom>>, Expression<Func<TFrom, TConnectTo>>, Expression<Func<TResult, TStartWith>>, Expression<Func<TNewResult, TAs>>, AggregateGraphLookupOptions<TFrom, TFrom, TNewResult>)Overloaded.
Appends a $graphLookup stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodGraphLookup<TResult, TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TNewResult>(IMongoCollection<TFrom>, Expression<Func<TFrom, TConnectFrom>>, Expression<Func<TFrom, TConnectTo>>, Expression<Func<TResult, TStartWith>>, Expression<Func<TNewResult, TAs>>, Expression<Func<TAsElement, Int32>>, AggregateGraphLookupOptions<TFrom, TAsElement, TNewResult>)Overloaded.
Appends a $graphLookup stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodGroup<TResult>(ProjectionDefinition<TResult, BsonDocument>)Overloaded.
Appends a group stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodGroup<TResult, TKey, TNewResult>(Expression<Func<TResult, TKey>>, Expression<Func<IGrouping<TKey, TResult>, TNewResult>>)Overloaded.
Appends a group stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodLookup<TResult>(String, FieldDefinition<TResult>, FieldDefinition<BsonDocument>, FieldDefinition<BsonDocument>)Overloaded.
Appends a lookup stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodLookup<TResult>(IMongoCollection<BsonDocument>, BsonDocument, PipelineDefinition<BsonDocument, BsonDocument>, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>>)Overloaded.
Appends a lookup stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodLookup<TResult, TForeignDocument, TNewResult>(IMongoCollection<TForeignDocument>, Expression<Func<TResult, Object>>, Expression<Func<TForeignDocument, Object>>, Expression<Func<TNewResult, Object>>, AggregateLookupOptions<TForeignDocument, TNewResult>)Overloaded.
Appends a lookup stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodLookup<TResult, TForeignDocument, TAsElement, TAs, TNewResult>(IMongoCollection<TForeignDocument>, BsonDocument, PipelineDefinition<TForeignDocument, TAsElement>, Expression<Func<TNewResult, TAs>>, AggregateLookupOptions<TForeignDocument, TNewResult>)Overloaded.
Appends a lookup stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodMatch<TResult>
Appends a match stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodProject<TResult>(ProjectionDefinition<TResult, BsonDocument>)Overloaded.
Appends a project stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodProject<TResult, TNewResult>(Expression<Func<TResult, TNewResult>>)Overloaded.
Appends a project stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodReplaceRoot<TResult, TNewResult>
Appends a $replaceRoot stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodReplaceWith<TResult, TNewResult>
Appends a $replaceWith stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSetWindowFields<TResult, TWindowFields>(Expression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>>)Overloaded.
Appends a $setWindowFields to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSetWindowFields<TResult, TPartitionBy, TWindowFields>(Expression<Func<TResult, TPartitionBy>>, Expression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>>)Overloaded.
Appends a $setWindowFields to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSetWindowFields<TResult, TPartitionBy, TWindowFields>(Expression<Func<TResult, TPartitionBy>>, SortDefinition<TResult>, Expression<Func<ISetWindowFieldsPartition<TResult>, TWindowFields>>)Overloaded.
Appends a $setWindowFields to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSingle<TResult>(CancellationToken)Overloaded.
Returns the only document of a cursor returned by a cursor source. This method throws an exception if the cursor does not contain exactly one document.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodSingle<TResult>(CancellationToken)Overloaded.
Returns the only document of the aggregate result. Throws an exception if the result set does not contain exactly one document.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSingleAsync<TResult>(CancellationToken)Overloaded.
Returns the only document of a cursor returned by a cursor source. This method throws an exception if the cursor does not contain exactly one document.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodSingleAsync<TResult>(CancellationToken)Overloaded.
Returns the only document of the aggregate result. Throws an exception if the result set does not contain exactly one document.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSingleOrDefault<TResult>(CancellationToken)Overloaded.
Returns the only document of a cursor returned by a cursor source, or a default value if the cursor contains no documents. This method throws an exception if the cursor contains more than one document.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodSingleOrDefault<TResult>(CancellationToken)Overloaded.
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.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSingleOrDefaultAsync<TResult>(CancellationToken)Overloaded.
Returns the only document of a cursor returned by a cursor source, or a default value if the cursor contains no documents. This method throws an exception if the cursor contains more than one document.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodSingleOrDefaultAsync<TResult>(CancellationToken)Overloaded.
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.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSortBy<TResult>
Appends an ascending sort stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSortByCount<TResult, TKey>
Appends a sortByCount stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodSortByDescending<TResult>
Appends a descending sort stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodToEnumerable<TResult>
Wraps a cursor source in an IEnumerable. Each time GetEnumerator is called a new cursor is fetched from the cursor source.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodToList<TResult>
Returns a list containing all the documents returned by the cursor returned by a cursor source.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodToListAsync<TResult>
Returns a list containing all the documents returned by the cursor returned by a cursor source.
(Defined by IAsyncCursorSourceExtensions.)
Public Extension MethodUnwind<TResult>(Expression<Func<TResult, Object>>)Overloaded.
Appends an unwind stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodUnwind<TResult>(FieldDefinition<TResult>)Overloaded.
Appends an unwind stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodUnwind<TResult, TNewResult>(Expression<Func<TResult, Object>>, IBsonSerializer<TNewResult>)Overloaded.
Appends an unwind stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Public Extension MethodUnwind<TResult, TNewResult>(Expression<Func<TResult, Object>>, AggregateUnwindOptions<TNewResult>)Overloaded.
Appends an unwind stage to the pipeline.
(Defined by IAggregateFluentExtensions.)
Top
Remarks
See Also