1
1
.. _csharp-aggregation-stages:
2
+ .. _csharp-builders-aggregation:
3
+ .. _csharp-linq:
2
4
3
5
===========================
4
6
Aggregation Pipeline Stages
@@ -104,10 +106,9 @@ Aggregation Stage Methods
104
106
-------------------------
105
107
106
108
The following table lists the builder methods in the {+driver-short+} that correspond
107
- to stages in the aggregation pipeline. To learn more about an aggregation stage,
108
- follow the link from the method name to its reference page in the {+mdb-server+} manual.
109
- To learn more about a builder method, follow the link from the method name to its
110
- dedicated page.
109
+ to stages in the aggregation pipeline. To learn more about an aggregation stage and
110
+ see a code example for the equivalent C# method, follow the link from the stage name
111
+ to its reference page in the {+mdb-server+} manual.
111
112
112
113
If an aggregation stage isn't in the table, the driver doesn't provide a builder method for
113
114
it. In this case, you must use the
@@ -125,56 +126,56 @@ to your pipeline.
125
126
* - :manual:`$bucket </reference/operator/aggregation/bucket/>`
126
127
- Categorizes incoming documents into groups, called buckets,
127
128
based on a specified expression and bucket boundaries.
128
- - :ref:` Bucket() <csharp-aggregation-bucket> `
129
+ - `` Bucket()` `
129
130
130
131
* - :manual:`$bucketAuto </reference/operator/aggregation/bucketAuto/>`
131
132
- Categorizes incoming documents into a specific number of
132
133
groups, called buckets, based on a specified expression.
133
134
Bucket boundaries are automatically determined in an attempt
134
135
to evenly distribute the documents into the specified number
135
136
of buckets.
136
- - :ref:` BucketAuto() <csharp-aggregation-bucketauto> `
137
+ - `` BucketAuto()` `
137
138
138
139
* - :manual:`$changeStream </reference/operator/aggregation/changeStream/>`
139
140
- Returns a change stream cursor for the
140
141
collection. This stage can occur only once in an aggregation
141
142
pipeline and it must occur as the first stage.
142
- - :ref:` ChangeStream() <csharp-aggregation-changestream> `
143
+ - `` ChangeStream()` `
143
144
144
145
* - :manual:`$changeStreamSplitLargeEvent </reference/operator/aggregation/changeStreamSplitLargeEvent/>`
145
146
- Splits large change stream events that exceed 16 MB into smaller fragments returned
146
147
in a change stream cursor.
147
148
148
149
You can use ``$changeStreamSplitLargeEvent`` only in a ``$changeStream`` pipeline, and
149
150
it must be the final stage in the pipeline.
150
- - :ref:` ChangeStreamSplitLargeEvent() <csharp-aggregation-changestreamsplitlargeevent> `
151
+ - `` ChangeStreamSplitLargeEvent()` `
151
152
152
153
* - :manual:`$count </reference/operator/aggregation/count/>`
153
154
- Returns a count of the number of documents at this stage of
154
155
the aggregation pipeline.
155
- - :ref:` Count() <csharp-aggregation-count> `
156
+ - `` Count()` `
156
157
157
158
* - :manual:`$densify </reference/operator/aggregation/densify/>`
158
159
- Creates new documents in a sequence of documents where certain values in a field are missing.
159
- - :ref:` Densify() <csharp-aggregation-densify> `
160
+ - `` Densify()` `
160
161
161
162
* - :manual:`$documents </reference/operator/aggregation/documents/>`
162
163
- Returns literal documents from input expressions.
163
- - :ref:` Documents() <csharp-aggregation-documents> `
164
+ - `` Documents()` `
164
165
165
166
* - :manual:`$facet </reference/operator/aggregation/facet/>`
166
167
- Processes multiple aggregation pipelines
167
168
within a single stage on the same set
168
169
of input documents. Enables the creation of multi-faceted
169
170
aggregations capable of characterizing data across multiple
170
171
dimensions, or facets, in a single stage.
171
- - :ref:` Facet() <csharp-aggregation-facet> `
172
+ - `` Facet()` `
172
173
173
174
* - :manual:`$graphLookup </reference/operator/aggregation/graphLookup/>`
174
175
- Performs a recursive search on a collection. This method adds
175
176
a new array field to each output document that contains the traversal
176
177
results of the recursive search for that document.
177
- - :ref:` GraphLookup() <csharp-aggregation-graphlookup> `
178
+ - `` GraphLookup()` `
178
179
179
180
* - :manual:`$group </reference/operator/aggregation/group/>`
180
181
- Groups input documents by a specified identifier expression
@@ -183,27 +184,27 @@ to your pipeline.
183
184
document per each distinct group. The output documents
184
185
contain only the identifier field and, if specified, accumulated
185
186
fields.
186
- - :ref:` Group() <csharp-aggregation-group> `
187
+ - `` Group()` `
187
188
188
189
* - :manual:`$limit </reference/operator/aggregation/limit/>`
189
190
- Passes the first *n* documents unmodified to the pipeline,
190
191
where *n* is the specified limit. For each input document,
191
192
outputs either one document (for the first *n* documents) or
192
193
zero documents (after the first *n* documents).
193
- - :ref:` Limit() <csharp-aggregation-limit> `
194
+ - `` Limit()` `
194
195
195
196
* - :manual:`$lookup </reference/operator/aggregation/facet/>`
196
197
- Performs a left outer join to another collection in the
197
198
*same* database to filter in documents from the "joined"
198
199
collection for processing.
199
- - :ref:` Lookup() <csharp-aggregation-lookup> `
200
+ - `` Lookup()` `
200
201
201
202
* - :manual:`$match </reference/operator/aggregation/match/>`
202
203
- Filters the document stream to allow only matching documents
203
204
to pass unmodified into the next pipeline stage.
204
205
For each input document, outputs either one document (a match) or zero
205
206
documents (no match).
206
- - :ref:` Match() <csharp-aggregation-match> `
207
+ - `` Match()` `
207
208
208
209
* - :manual:`$merge </reference/operator/aggregation/merge/>`
209
210
- Writes the resulting documents of the aggregation pipeline to
@@ -213,24 +214,24 @@ to your pipeline.
213
214
custom update pipeline) the results into an output
214
215
collection. To use this stage, it must be
215
216
the last stage in the pipeline.
216
- - :ref:` Merge() <csharp-aggregation-merge> `
217
+ - `` Merge()` `
217
218
218
219
* - :manual:`$out </reference/operator/aggregation/out/>`
219
220
- Writes the resulting documents of the aggregation pipeline to
220
221
a collection. To use this stage, it must be
221
222
the last stage in the pipeline.
222
- - :ref:` Out() <csharp-aggregation-out> `
223
+ - `` Out()` `
223
224
224
225
* - :manual:`$project </reference/operator/aggregation/project/>`
225
226
- Reshapes each document in the stream, such as by adding new
226
227
fields or removing existing fields. For each input document,
227
228
outputs one document.
228
- - :ref:` Project() <csharp-aggregation-project> `
229
+ - `` Project()` `
229
230
230
231
* - :manual:`$rankFusion </reference/operator/aggregation/rankFusion/>`
231
232
- Uses a rank fusion algorithm to combine results from a Vector Search
232
233
query and an Atlas Search query.
233
- - :ref:` RankFusion() <csharp-aggregation-rankfusion> `
234
+ - `` RankFusion()` `
234
235
235
236
* - :manual:`$replaceRoot </reference/operator/aggregation/replaceRoot/>`
236
237
- Replaces a document with the specified embedded document. The
@@ -240,7 +241,7 @@ to your pipeline.
240
241
top level.
241
242
242
243
The ``$replaceWith`` stage is an alias for the ``$replaceRoot`` stage.
243
- - :ref:` ReplaceRoot() <csharp-aggregation-replaceroot> `
244
+ - `` ReplaceRoot()` `
244
245
245
246
* - :manual:`$replaceWith </reference/operator/aggregation/replaceWith/>`
246
247
- Replaces a document with the specified embedded document.
@@ -249,12 +250,12 @@ to your pipeline.
249
250
the embedded document to the top level.
250
251
251
252
The ``$replaceWith`` stage is an alias for the ``$replaceRoot`` stage.
252
- - :ref:` ReplaceWith() <csharp-aggregation-replacewith> `
253
+ - `` ReplaceWith()` `
253
254
254
255
* - :manual:`$sample </reference/operator/aggregation/sample/>`
255
256
- Randomly selects the specified number of documents from its
256
257
input.
257
- - :ref:` Sample() <csharp-aggregation-sample> `
258
+ - `` Sample()` `
258
259
259
260
* - :manual:`$search </reference/operator/aggregation/search/>`
260
261
- Performs a full-text search of the field or fields in an
@@ -265,7 +266,7 @@ to your pipeline.
265
266
available for self-managed deployments. To learn more, see
266
267
:atlas:`Atlas Search Aggregation Pipeline Stages
267
268
</reference/atlas-search/query-syntax>` in the Atlas documentation.
268
- - :ref:` Search() <csharp-aggregation-search> `
269
+ - `` Search()` `
269
270
270
271
* - :manual:`$searchMeta </reference/operator/aggregation/searchMeta/>`
271
272
- Returns different types of metadata result documents for the
@@ -277,52 +278,52 @@ to your pipeline.
277
278
and is not available for self-managed deployments. To learn
278
279
more, see :atlas:`Atlas Search Aggregation Pipeline Stages
279
280
</reference/atlas-search/query-syntax>` in the Atlas documentation.
280
- - :ref:` SearchMeta() <csharp-aggregation-searchmeta> `
281
+ - `` SearchMeta()` `
281
282
282
283
* - :manual:`$set </reference/operator/aggregation/set/>`
283
284
- Adds new fields to documents. Like the ``Project()`` method,
284
285
this method reshapes each
285
286
document in the stream by adding new fields to
286
287
output documents that contain both the existing fields
287
288
from the input documents and the newly added fields.
288
- - :ref:` Set() <csharp-aggregation-set> `
289
+ - `` Set()` `
289
290
290
291
* - :manual:`$setWindowFields </reference/operator/aggregation/setWindowFields/>`
291
292
- Groups documents into windows and applies one or more
292
293
operators to the documents in each window.
293
- - :ref:` SetWindowFields() <csharp-aggregation-setwindowfields> `
294
+ - `` SetWindowFields()` `
294
295
295
296
* - :manual:`$skip </reference/operator/aggregation/skip/>`
296
297
- Skips the first *n* documents, where *n* is the specified skip
297
298
number, and passes the remaining documents unmodified to the
298
299
pipeline. For each input document, outputs either zero
299
300
documents (for the first *n* documents) or one document (if
300
301
after the first *n* documents).
301
- - :ref:` Skip() <csharp-aggregation-skip> `
302
+ - `` Skip()` `
302
303
303
304
* - :manual:`$sort </reference/operator/aggregation/sort/>`
304
305
- Reorders the document stream by a specified sort key. The documents remain unmodified.
305
306
For each input document, outputs one document.
306
- - :ref:` Sort() <csharp-aggregation-sort> `
307
+ - `` Sort()` `
307
308
308
309
* - :manual:`$sortByCount </reference/operator/aggregation/sortByCount/>`
309
310
- Groups incoming documents based on the value of a specified
310
311
expression, then computes the count of documents in each
311
312
distinct group.
312
- - :ref:` SortByCount() <csharp-aggregation-sortbycount> `
313
+ - `` SortByCount()` `
313
314
314
315
* - :manual:`$unionWith </reference/operator/aggregation/unionWith/>`
315
316
- Combines pipeline results from two collections into a single
316
317
result set.
317
- - :ref:` UnionWith() <csharp-aggregation-unionwith> `
318
+ - `` UnionWith()` `
318
319
319
320
* - :manual:`$unwind </reference/operator/aggregation/unwind/>`
320
321
- Deconstructs an array field from the input documents to
321
322
output a document for *each* element. Each output document
322
323
replaces the array with an element value. For each input
323
324
document, outputs *n* Documents, where *n* is the number of
324
325
array elements. *n* can be zero for an empty array.
325
- - :ref:` Unwind() <csharp-aggregation-unwind> `
326
+ - `` Unwind()` `
326
327
327
328
* - :manual:`$vectorSearch </reference/operator/aggregation/vectorSearch/>`
328
329
- Performs an :abbr:`ANN (Approximate Nearest Neighbor)` or
@@ -333,7 +334,7 @@ to your pipeline.
333
334
This stage is available only for MongoDB Atlas clusters, and is not
334
335
available for self-managed deployments. To learn more, see
335
336
:ref:`Atlas Vector Search <csharp-atlas-vector-search>`.
336
- - :ref:` VectorSearch() <csharp-aggregation-vectorsearch> `
337
+ - `` VectorSearch()` `
337
338
338
339
API Documentation
339
340
-----------------
0 commit comments