Class AggregateFluentBase<TResult>
Base class for implementors of IAggregateFluent<TResult>.
public abstract class AggregateFluentBase<TResult> : IOrderedAggregateFluent<TResult>, IAggregateFluent<TResult>, IAsyncCursorSource<TResult>
Type Parameters
TResultThe type of the document.
- Inheritance
-
AggregateFluentBase<TResult>
- Implements
-
IOrderedAggregateFluent<TResult>IAggregateFluent<TResult>IAsyncCursorSource<TResult>
- Inherited Members
- Extension Methods
Properties
Database
Gets the database.
public virtual IMongoDatabase Database { get; }
Property Value
Options
Gets the options.
public abstract AggregateOptions Options { get; }
Property Value
Stages
Gets the stages.
public abstract IList<IPipelineStageDefinition> Stages { get; }
Property Value
Methods
AppendStage<TNewResult>(PipelineStageDefinition<TResult, TNewResult>)
Appends the stage to the pipeline.
public abstract IAggregateFluent<TNewResult> AppendStage<TNewResult>(PipelineStageDefinition<TResult, TNewResult> stage)
Parameters
stagePipelineStageDefinition<TResult, TNewResult>The stage.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the result of the stage.
As<TNewResult>(IBsonSerializer<TNewResult>)
Changes the result type of the pipeline.
public abstract IAggregateFluent<TNewResult> As<TNewResult>(IBsonSerializer<TNewResult> newResultSerializer)
Parameters
newResultSerializerIBsonSerializer<TNewResult>The new result serializer.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the new result.
BucketAuto<TValue>(AggregateExpressionDefinition<TResult, TValue>, int, AggregateBucketAutoOptions)
Appends a $bucketAuto stage to the pipeline.
public virtual IAggregateFluent<AggregateBucketAutoResult<TValue>> BucketAuto<TValue>(AggregateExpressionDefinition<TResult, TValue> groupBy, int buckets, AggregateBucketAutoOptions options = null)
Parameters
groupByAggregateExpressionDefinition<TResult, TValue>The expression providing the value to group by.
bucketsintThe number of buckets.
optionsAggregateBucketAutoOptionsThe options (optional).
Returns
- IAggregateFluent<AggregateBucketAutoResult<TValue>>
The fluent aggregate interface.
Type Parameters
TValueThe type of the value.
BucketAuto<TValue, TNewResult>(AggregateExpressionDefinition<TResult, TValue>, int, ProjectionDefinition<TResult, TNewResult>, AggregateBucketAutoOptions)
Appends a $bucketAuto stage to the pipeline with a custom projection.
public virtual IAggregateFluent<TNewResult> BucketAuto<TValue, TNewResult>(AggregateExpressionDefinition<TResult, TValue> groupBy, int buckets, ProjectionDefinition<TResult, TNewResult> output, AggregateBucketAutoOptions options = null)
Parameters
groupByAggregateExpressionDefinition<TResult, TValue>The expression providing the value to group by.
bucketsintThe number of buckets.
outputProjectionDefinition<TResult, TNewResult>The output projection.
optionsAggregateBucketAutoOptionsThe options (optional).
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TValueThe type of the value.
TNewResultThe type of the new result.
Bucket<TValue>(AggregateExpressionDefinition<TResult, TValue>, IEnumerable<TValue>, AggregateBucketOptions<TValue>)
Appends a $bucket stage to the pipeline.
public virtual IAggregateFluent<AggregateBucketResult<TValue>> Bucket<TValue>(AggregateExpressionDefinition<TResult, TValue> groupBy, IEnumerable<TValue> boundaries, AggregateBucketOptions<TValue> options = null)
Parameters
groupByAggregateExpressionDefinition<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
TValueThe type of the value.
Bucket<TValue, TNewResult>(AggregateExpressionDefinition<TResult, TValue>, IEnumerable<TValue>, ProjectionDefinition<TResult, TNewResult>, AggregateBucketOptions<TValue>)
Appends a $bucket stage to the pipeline with a custom projection.
public virtual IAggregateFluent<TNewResult> Bucket<TValue, TNewResult>(AggregateExpressionDefinition<TResult, TValue> groupBy, IEnumerable<TValue> boundaries, ProjectionDefinition<TResult, TNewResult> output, AggregateBucketOptions<TValue> options = null)
Parameters
groupByAggregateExpressionDefinition<TResult, TValue>The expression providing the value to group by.
boundariesIEnumerable<TValue>The bucket boundaries.
outputProjectionDefinition<TResult, TNewResult>The output projection.
optionsAggregateBucketOptions<TValue>The options.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TValueThe type of the value.
TNewResultThe type of the new result.
ChangeStream(ChangeStreamStageOptions)
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 virtual IAggregateFluent<ChangeStreamDocument<TResult>> ChangeStream(ChangeStreamStageOptions options = null)
Parameters
optionsChangeStreamStageOptionsThe options.
Returns
- IAggregateFluent<ChangeStreamDocument<TResult>>
The fluent aggregate interface.
Count()
Appends a count stage to the pipeline.
public virtual IAggregateFluent<AggregateCountResult> Count()
Returns
- IAggregateFluent<AggregateCountResult>
The fluent aggregate interface.
Densify(FieldDefinition<TResult>, DensifyRange, params FieldDefinition<TResult>[])
Appends a $densify stage to the pipeline.
public virtual IAggregateFluent<TResult> Densify(FieldDefinition<TResult> field, DensifyRange range, params FieldDefinition<TResult>[] partitionByFields)
Parameters
fieldFieldDefinition<TResult>The field.
rangeDensifyRangeThe range.
partitionByFieldsFieldDefinition<TResult>[]The fields to partition by.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
Densify(FieldDefinition<TResult>, DensifyRange, IEnumerable<FieldDefinition<TResult>>)
Appends a $densify stage to the pipeline.
public virtual IAggregateFluent<TResult> Densify(FieldDefinition<TResult> field, DensifyRange range, IEnumerable<FieldDefinition<TResult>> partitionByFields = null)
Parameters
fieldFieldDefinition<TResult>The field.
rangeDensifyRangeThe range.
partitionByFieldsIEnumerable<FieldDefinition<TResult>>The fields to partition by.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
Facet<TNewResult>(IEnumerable<AggregateFacet<TResult>>, AggregateFacetOptions<TNewResult>)
Appends a $facet stage to the pipeline.
public virtual IAggregateFluent<TNewResult> Facet<TNewResult>(IEnumerable<AggregateFacet<TResult>> facets, AggregateFacetOptions<TNewResult> options = null)
Parameters
facetsIEnumerable<AggregateFacet<TResult>>The facets.
optionsAggregateFacetOptions<TNewResult>The options.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the new result.
GraphLookup<TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TNewResult>(IMongoCollection<TFrom>, FieldDefinition<TFrom, TConnectFrom>, FieldDefinition<TFrom, TConnectTo>, AggregateExpressionDefinition<TResult, TStartWith>, FieldDefinition<TNewResult, TAs>, FieldDefinition<TAsElement, int>, AggregateGraphLookupOptions<TFrom, TAsElement, TNewResult>)
Appends a $graphLookup stage to the pipeline.
public virtual IAggregateFluent<TNewResult> GraphLookup<TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TNewResult>(IMongoCollection<TFrom> from, FieldDefinition<TFrom, TConnectFrom> connectFromField, FieldDefinition<TFrom, TConnectTo> connectToField, AggregateExpressionDefinition<TResult, TStartWith> startWith, FieldDefinition<TNewResult, TAs> @as, FieldDefinition<TAsElement, int> depthField, AggregateGraphLookupOptions<TFrom, TAsElement, TNewResult> options = null) where TAs : IEnumerable<TAsElement>
Parameters
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.
depthFieldFieldDefinition<TAsElement, int>The depth field.
optionsAggregateGraphLookupOptions<TFrom, TAsElement, TNewResult>The options.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TFromThe type of the from documents.
TConnectFromThe type of the connect from field (must be either TConnectTo or a type that implements IEnumerable{TConnectTo}).
TConnectToThe type of the connect to field.
TStartWithThe type of the start with expression (must be either TConnectTo or a type that implements IEnumerable{TConnectTo}).
TAsElementThe type of the as field elements.
TAsThe type of the as field.
TNewResultThe type of the new result (must be same as TResult with an additional as field).
Group<TNewResult>(ProjectionDefinition<TResult, TNewResult>)
Appends a group stage to the pipeline.
public abstract IAggregateFluent<TNewResult> Group<TNewResult>(ProjectionDefinition<TResult, TNewResult> group)
Parameters
groupProjectionDefinition<TResult, TNewResult>The group projection.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the result of the stage.
Limit(long)
Appends a limit stage to the pipeline.
public abstract IAggregateFluent<TResult> Limit(long limit)
Parameters
limitlongThe limit.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
Lookup<TForeignDocument, TNewResult>(string, FieldDefinition<TResult>, FieldDefinition<TForeignDocument>, FieldDefinition<TNewResult>, AggregateLookupOptions<TForeignDocument, TNewResult>)
Appends a lookup stage to the pipeline.
public virtual IAggregateFluent<TNewResult> Lookup<TForeignDocument, TNewResult>(string foreignCollectionName, FieldDefinition<TResult> localField, FieldDefinition<TForeignDocument> foreignField, FieldDefinition<TNewResult> @as, AggregateLookupOptions<TForeignDocument, TNewResult> options)
Parameters
foreignCollectionNamestringName of the other collection.
localFieldFieldDefinition<TResult>The local field.
foreignFieldFieldDefinition<TForeignDocument>The foreign field.
asFieldDefinition<TNewResult>The field in TNewResult to place the foreign results.
optionsAggregateLookupOptions<TForeignDocument, TNewResult>The options.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TForeignDocumentThe type of the foreign document.
TNewResultThe type of the new result.
Lookup<TForeignDocument, TAsElement, TAs, TNewResult>(IMongoCollection<TForeignDocument>, BsonDocument, PipelineDefinition<TForeignDocument, TAsElement>, FieldDefinition<TNewResult, TAs>, AggregateLookupOptions<TForeignDocument, TNewResult>)
Appends a lookup stage to the pipeline.
public virtual IAggregateFluent<TNewResult> Lookup<TForeignDocument, TAsElement, TAs, TNewResult>(IMongoCollection<TForeignDocument> foreignCollection, BsonDocument let, PipelineDefinition<TForeignDocument, TAsElement> lookupPipeline, FieldDefinition<TNewResult, TAs> @as, AggregateLookupOptions<TForeignDocument, TNewResult> options = null) where TAs : IEnumerable<TAsElement>
Parameters
foreignCollectionIMongoCollection<TForeignDocument>The foreign collection.
letBsonDocumentThe "let" definition.
lookupPipelinePipelineDefinition<TForeignDocument, TAsElement>The lookup pipeline.
asFieldDefinition<TNewResult, TAs>The as field in TNewResult in which to place the results of the lookup pipeline.
optionsAggregateLookupOptions<TForeignDocument, TNewResult>The options.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TForeignDocumentThe type of the foreign collection documents.
TAsElementThe type of the as field elements.
TAsThe type of the as field.
TNewResultThe type of the new result.
Match(FilterDefinition<TResult>)
Appends a match stage to the pipeline.
public abstract IAggregateFluent<TResult> Match(FilterDefinition<TResult> filter)
Parameters
filterFilterDefinition<TResult>The filter.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
MergeAsync<TOutput>(IMongoCollection<TOutput>, MergeStageOptions<TOutput>, CancellationToken)
Appends a merge stage to the pipeline and executes it, and then returns a cursor to read the contents of the output collection.
public virtual Task<IAsyncCursor<TOutput>> MergeAsync<TOutput>(IMongoCollection<TOutput> outputCollection, MergeStageOptions<TOutput> mergeOptions = null, CancellationToken cancellationToken = default)
Parameters
outputCollectionIMongoCollection<TOutput>The output collection.
mergeOptionsMergeStageOptions<TOutput>The merge options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<TOutput>>
A cursor.
Type Parameters
TOutputThe type of output documents.
Merge<TOutput>(IMongoCollection<TOutput>, MergeStageOptions<TOutput>, CancellationToken)
Appends a merge stage to the pipeline and executes it, and then returns a cursor to read the contents of the output collection.
public virtual IAsyncCursor<TOutput> Merge<TOutput>(IMongoCollection<TOutput> outputCollection, MergeStageOptions<TOutput> mergeOptions = null, CancellationToken cancellationToken = default)
Parameters
outputCollectionIMongoCollection<TOutput>The output collection.
mergeOptionsMergeStageOptions<TOutput>The merge options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TOutput>
A cursor.
Type Parameters
TOutputThe type of output documents.
OfType<TNewResult>(IBsonSerializer<TNewResult>)
Appends a match stage to the pipeline that matches derived documents and changes the result type to the derived type.
public abstract IAggregateFluent<TNewResult> OfType<TNewResult>(IBsonSerializer<TNewResult> newResultSerializer) where TNewResult : TResult
Parameters
newResultSerializerIBsonSerializer<TNewResult>The new result serializer.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the derived documents.
Out(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 virtual IAsyncCursor<TResult> Out(IMongoCollection<TResult> outputCollection, CancellationToken cancellationToken)
Parameters
outputCollectionIMongoCollection<TResult>The output collection.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TResult>
A cursor.
Out(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 virtual IAsyncCursor<TResult> Out(string collectionName, CancellationToken cancellationToken)
Parameters
collectionNamestringName of the collection.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TResult>
A cursor.
OutAsync(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 virtual Task<IAsyncCursor<TResult>> OutAsync(IMongoCollection<TResult> outputCollection, CancellationToken cancellationToken)
Parameters
outputCollectionIMongoCollection<TResult>The output collection.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<TResult>>
A Task whose result is a cursor.
OutAsync(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 abstract Task<IAsyncCursor<TResult>> OutAsync(string collectionName, CancellationToken cancellationToken)
Parameters
collectionNamestringName of the collection.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<TResult>>
A Task whose result is a cursor.
Project<TNewResult>(ProjectionDefinition<TResult, TNewResult>)
Appends a project stage to the pipeline.
public abstract IAggregateFluent<TNewResult> Project<TNewResult>(ProjectionDefinition<TResult, TNewResult> projection)
Parameters
projectionProjectionDefinition<TResult, TNewResult>The projection.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the result of the stage.
ReplaceRoot<TNewResult>(AggregateExpressionDefinition<TResult, TNewResult>)
Appends a $replaceRoot stage to the pipeline.
public virtual IAggregateFluent<TNewResult> ReplaceRoot<TNewResult>(AggregateExpressionDefinition<TResult, TNewResult> newRoot)
Parameters
newRootAggregateExpressionDefinition<TResult, TNewResult>The new root.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the new result.
ReplaceWith<TNewResult>(AggregateExpressionDefinition<TResult, TNewResult>)
Appends a $replaceWith stage to the pipeline.
public virtual IAggregateFluent<TNewResult> ReplaceWith<TNewResult>(AggregateExpressionDefinition<TResult, TNewResult> newRoot)
Parameters
newRootAggregateExpressionDefinition<TResult, TNewResult>The new root.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the new result.
Search(SearchDefinition<TResult>, SearchHighlightOptions<TResult>, string, SearchCountOptions, bool, bool)
Appends a $search stage to the pipeline.
public virtual IAggregateFluent<TResult> Search(SearchDefinition<TResult> searchDefinition, SearchHighlightOptions<TResult> highlight = null, string indexName = null, SearchCountOptions count = null, bool returnStoredSource = false, bool scoreDetails = false)
Parameters
searchDefinitionSearchDefinition<TResult>The search definition.
highlightSearchHighlightOptions<TResult>The highlight options.
indexNamestringThe index name.
countSearchCountOptionsThe count options.
returnStoredSourceboolFlag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search.
scoreDetailsboolFlag that specifies whether to return a detailed breakdown of the score for each document in the result.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
Search(SearchDefinition<TResult>, SearchOptions<TResult>)
Appends a $search stage to the pipeline.
public virtual IAggregateFluent<TResult> Search(SearchDefinition<TResult> searchDefinition, SearchOptions<TResult> searchOptions)
Parameters
searchDefinitionSearchDefinition<TResult>The search definition.
searchOptionsSearchOptions<TResult>The search options.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
SearchMeta(SearchDefinition<TResult>, string, SearchCountOptions)
Appends a $searchMeta stage to the pipeline.
public virtual IAggregateFluent<SearchMetaResult> SearchMeta(SearchDefinition<TResult> searchDefinition, string indexName = null, SearchCountOptions count = null)
Parameters
searchDefinitionSearchDefinition<TResult>The search definition.
indexNamestringThe index name.
countSearchCountOptionsThe count options.
Returns
- IAggregateFluent<SearchMetaResult>
The fluent aggregate interface.
Set(SetFieldDefinitions<TResult>)
Appends a $set stage to the pipeline.
public virtual IAggregateFluent<TResult> Set(SetFieldDefinitions<TResult> fields)
Parameters
fieldsSetFieldDefinitions<TResult>The fields to set.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
SetWindowFields<TWindowFields>(AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields>)
Appends a $setWindowFields to the pipeline.
public virtual IAggregateFluent<BsonDocument> SetWindowFields<TWindowFields>(AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields> output)
Parameters
outputAggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields>The window fields definition.
Returns
- IAggregateFluent<BsonDocument>
The fluent aggregate interface.
Type Parameters
TWindowFieldsThe type of the added window fields.
SetWindowFields<TPartitionBy, TWindowFields>(AggregateExpressionDefinition<TResult, TPartitionBy>, AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields>)
Appends a $setWindowFields to the pipeline.
public virtual IAggregateFluent<BsonDocument> SetWindowFields<TPartitionBy, TWindowFields>(AggregateExpressionDefinition<TResult, TPartitionBy> partitionBy, AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields> output)
Parameters
partitionByAggregateExpressionDefinition<TResult, TPartitionBy>The partitionBy definition.
outputAggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields>The window fields definition.
Returns
- IAggregateFluent<BsonDocument>
The fluent aggregate interface.
Type Parameters
TPartitionByThe type of the value to partition by.
TWindowFieldsThe type of the added window fields.
SetWindowFields<TPartitionBy, TWindowFields>(AggregateExpressionDefinition<TResult, TPartitionBy>, SortDefinition<TResult>, AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields>)
Appends a $setWindowFields to the pipeline.
public virtual IAggregateFluent<BsonDocument> SetWindowFields<TPartitionBy, TWindowFields>(AggregateExpressionDefinition<TResult, TPartitionBy> partitionBy, SortDefinition<TResult> sortBy, AggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields> output)
Parameters
partitionByAggregateExpressionDefinition<TResult, TPartitionBy>The partitionBy definition.
sortBySortDefinition<TResult>The sortBy definition.
outputAggregateExpressionDefinition<ISetWindowFieldsPartition<TResult>, TWindowFields>The window fields definition.
Returns
- IAggregateFluent<BsonDocument>
The fluent aggregate interface.
Type Parameters
TPartitionByThe type of the value to partition by.
TWindowFieldsThe type of the added window fields.
Skip(long)
Appends a skip stage to the pipeline.
public abstract IAggregateFluent<TResult> Skip(long skip)
Parameters
skiplongThe number of documents to skip.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
Sort(SortDefinition<TResult>)
Appends a sort stage to the pipeline.
public abstract IAggregateFluent<TResult> Sort(SortDefinition<TResult> sort)
Parameters
sortSortDefinition<TResult>The sort specification.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
SortByCount<TId>(AggregateExpressionDefinition<TResult, TId>)
Appends a sortByCount stage to the pipeline.
public virtual IAggregateFluent<AggregateSortByCountResult<TId>> SortByCount<TId>(AggregateExpressionDefinition<TResult, TId> id)
Parameters
idAggregateExpressionDefinition<TResult, TId>The identifier.
Returns
- IAggregateFluent<AggregateSortByCountResult<TId>>
The fluent aggregate interface.
Type Parameters
TIdThe type of the identifier.
ThenBy(SortDefinition<TResult>)
Combines the current sort definition with an additional sort definition.
public virtual IOrderedAggregateFluent<TResult> ThenBy(SortDefinition<TResult> newSort)
Parameters
newSortSortDefinition<TResult>The new sort.
Returns
- IOrderedAggregateFluent<TResult>
The fluent aggregate interface.
ToCollection(CancellationToken)
Executes an aggregation pipeline that writes the results to a collection.
public virtual void ToCollection(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
ToCollectionAsync(CancellationToken)
Executes an aggregation pipeline that writes the results to a collection.
public virtual Task ToCollectionAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A Task.
ToCursor(CancellationToken)
Executes the operation and returns a cursor to the results.
public virtual IAsyncCursor<TResult> ToCursor(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TResult>
A cursor.
ToCursorAsync(CancellationToken)
Executes the operation and returns a cursor to the results.
public abstract Task<IAsyncCursor<TResult>> ToCursorAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<TResult>>
A Task whose result is a cursor.
UnionWith<TWith>(IMongoCollection<TWith>, PipelineDefinition<TWith, TResult>)
Appends an $unionWith stage to the pipeline.
public virtual IAggregateFluent<TResult> UnionWith<TWith>(IMongoCollection<TWith> withCollection, PipelineDefinition<TWith, TResult> withPipeline = null)
Parameters
withCollectionIMongoCollection<TWith>The with collection.
withPipelinePipelineDefinition<TWith, TResult>The with pipeline.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.
Type Parameters
TWithThe type of the with collection documents.
Unwind<TNewResult>(FieldDefinition<TResult>, IBsonSerializer<TNewResult>)
Appends an unwind stage to the pipeline.
public abstract IAggregateFluent<TNewResult> Unwind<TNewResult>(FieldDefinition<TResult> field, IBsonSerializer<TNewResult> newResultSerializer)
Parameters
fieldFieldDefinition<TResult>The field.
newResultSerializerIBsonSerializer<TNewResult>The new result serializer.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the result of the stage.
Unwind<TNewResult>(FieldDefinition<TResult>, AggregateUnwindOptions<TNewResult>)
Appends an unwind stage to the pipeline.
public virtual IAggregateFluent<TNewResult> Unwind<TNewResult>(FieldDefinition<TResult> field, AggregateUnwindOptions<TNewResult> options)
Parameters
fieldFieldDefinition<TResult>The field.
optionsAggregateUnwindOptions<TNewResult>The options.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TNewResultThe type of the new result.
VectorSearch(FieldDefinition<TResult>, QueryVector, int, VectorSearchOptions<TResult>)
Appends a vector search stage.
public virtual IAggregateFluent<TResult> VectorSearch(FieldDefinition<TResult> field, QueryVector queryVector, int limit, VectorSearchOptions<TResult> options = null)
Parameters
fieldFieldDefinition<TResult>The field.
queryVectorQueryVectorThe query vector.
limitintThe limit.
optionsVectorSearchOptions<TResult>The vector search options.
Returns
- IAggregateFluent<TResult>
The fluent aggregate interface.