1
1
.. _csharp-aggregation-stages:
2
2
3
- ==================
4
- Aggregation Stages
5
- ==================
3
+ ===========================
4
+ Aggregation Pipeline Stages
5
+ ===========================
6
6
7
7
.. facet::
8
8
:name: genre
@@ -20,20 +20,20 @@ Aggregation Stages
20
20
Overview
21
21
--------
22
22
23
- On this page, you can learn how to create an aggregation pipeline and add stages to it
23
+ On this page, you can learn how to create an aggregation pipeline and pipeline stages
24
24
by using methods in the {+driver-short+}.
25
25
26
26
Build an Aggregation Pipeline
27
27
-----------------------------
28
28
29
- You can use the {+driver-short+} to build an aggregation pipeline by using builders
29
+ You can use the {+driver-short+} to build an aggregation pipeline by using builder
30
30
methods or BSON documents. See the following sections to learn more about each of these
31
31
approaches.
32
32
33
- .. _csharp-aggregation-stages-builders :
33
+ .. _csharp-aggregation-stages-builder :
34
34
35
- Builders
36
- ~~~~~~~~
35
+ Builder Methods
36
+ ~~~~~~~~~~~~~~~
37
37
38
38
You can build a type-safe aggregation pipeline in the following ways:
39
39
@@ -61,7 +61,7 @@ or :guilabel:`Aggregate` tab to see the corresponding code for each approach:
61
61
.Merge(...);
62
62
63
63
// Executes the aggregation pipeline
64
- var results = collection.Aggregate(pipeline).ToList() ;
64
+ var results = collection.Aggregate(pipeline);
65
65
66
66
.. tab:: Aggregate
67
67
:tabid: aggregate
@@ -86,13 +86,14 @@ to construct a stage in the Query API syntax. Then, pass the BSON document to th
86
86
in the aggregation pipeline, but doesn't provide type hints or type safety.
87
87
88
88
The following code example shows how to add ``$unset``, an aggregation
89
- stage without a corresponding method, to an empty aggregation pipeline:
89
+ stage without a corresponding builder method, to an empty aggregation pipeline:
90
90
91
91
.. code-block:: csharp
92
92
93
- var pipeline = new EmptyPipelineDefinition<BsonDocument>().AppendStage<BsonDocument, BsonDocument, BsonDocument>("{ $unset: "field1" }");
93
+ var pipeline = new EmptyPipelineDefinition<BsonDocument>()
94
+ .AppendStage<BsonDocument, BsonDocument, BsonDocument>("{ $unset: "field1" }");
94
95
95
- .. note ::
96
+ .. important ::
96
97
97
98
If you use a ``BsonDocument`` to define a pipeline stage, the driver doesn't
98
99
recognize any ``BsonClassMap`` attributes, serialization attributes, or
@@ -102,10 +103,14 @@ stage without a corresponding method, to an empty aggregation pipeline:
102
103
Aggregation Stage Methods
103
104
-------------------------
104
105
105
- The following table lists the builders methods in the {+driver-short+} that correspond
106
- to stages in the aggregation pipeline. For more information about an aggregation stage,
107
- click the stage name. For more information about a builders method, click the
108
- method name. If an aggregation stage isn't in the table, you must use the
106
+ 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.
111
+
112
+ If an aggregation stage isn't in the table, the driver doesn't provide a builder method for
113
+ it. In this case, you must use the
109
114
:ref:`BsonDocument <csharp-aggregation-stages-bsondocument>` syntax to add the stage
110
115
to your pipeline.
111
116
@@ -115,7 +120,7 @@ to your pipeline.
115
120
116
121
* - Aggregation Stage
117
122
- Description
118
- - Builders Method
123
+ - Builder Method
119
124
120
125
* - :manual:`$bucket </reference/operator/aggregation/bucket/>`
121
126
- Categorizes incoming documents into groups, called buckets,
@@ -166,8 +171,8 @@ to your pipeline.
166
171
- :ref:`Facet() <csharp-aggregation-facet>`
167
172
168
173
* - :manual:`$graphLookup </reference/operator/aggregation/graphLookup/>`
169
- - Performs a recursive search on a collection. To each output
170
- document, adds a new array field that contains the traversal
174
+ - Performs a recursive search on a collection. This method adds
175
+ a new array field to each output document that contains the traversal
171
176
results of the recursive search for that document.
172
177
- :ref:`GraphLookup() <csharp-aggregation-graphlookup>`
173
178
@@ -324,16 +329,23 @@ to your pipeline.
324
329
:abbr:`ENN (Exact Nearest Neighbor)` search on a
325
330
vector in the specified field of an
326
331
:atlas:`Atlas </reference/atlas-search/query-syntax/>` collection.
332
+
333
+ This stage is available only for MongoDB Atlas clusters, and is not
334
+ available for self-managed deployments. To learn more, see
335
+ :atlas:`Atlas Search Aggregation Pipeline Stages
336
+ </reference/atlas-search/query-syntax>` in the Atlas documentation.
327
337
- :ref:`VectorSearch() <csharp-aggregation-vectorsearch>`
328
338
329
339
API Documentation
330
340
-----------------
331
341
332
342
To learn more about assembling an aggregation pipeline, see
333
- :manual:`Aggregation Pipeline </core/aggregation-pipeline/>`.
343
+ :manual:`Aggregation Pipeline </core/aggregation-pipeline/>` in the {+mdb-server+}
344
+ manual.
334
345
335
346
To learn more about creating pipeline stages, see
336
- :manual:`Aggregation Stages </reference/operator/aggregation-pipeline/>`.
347
+ :manual:`Aggregation Stages </reference/operator/aggregation-pipeline/>` in the
348
+ {+mdb-server+} manual.
337
349
338
350
For more information about the methods and classes used on this page, see the
339
351
following API documentation:
0 commit comments