@@ -45,15 +45,15 @@ method. See the following examples to learn more about each of these approaches.
45
45
];
46
46
47
47
// Executes the aggregation pipeline
48
- const results = collection.aggregate(pipeline);
48
+ const results = async collection.aggregate(pipeline);
49
49
50
50
.. tab:: Direct Aggregation
51
51
:tabid: pipeline-direct
52
52
53
53
.. code-block:: javascript
54
54
55
55
// Defines and executes the aggregation pipeline
56
- collection.aggregate([
56
+ const results = async collection.aggregate([
57
57
{ $match: { ... } },
58
58
{ $group: { ... } }
59
59
]);
@@ -91,20 +91,21 @@ manual.
91
91
of buckets.
92
92
93
93
* - :manual:`$changeStream </reference/operator/aggregation/changeStream/>`
94
- - Returns a change stream cursor for the collection.
94
+ - Returns a change stream cursor for the collection. Must be the first stage
95
+ in the pipeline.
95
96
96
- Instead of being passed to the ``aggregate() `` method,
97
- ``$changeStream`` uses the ``watch ()`` method on a ``Collection``
98
- object .
97
+ ``$changeStream`` returns an ``AggregationCursor `` when passed to the
98
+ ``aggregate ()`` method and a ``ChangeStreamCursor`` when passed to the
99
+ ``watch()`` method .
99
100
100
101
* - :manual:`$changeStreamSplitLargeEvent
101
102
</reference/operator/aggregation/changeStreamSplitLargeEvent/>`
102
103
- Splits large change stream events that exceed 16 MB into smaller fragments returned
103
- in a change stream cursor.
104
+ in a change stream cursor. Must be the first stage in the pipeline.
104
105
105
- Instead of being passed to the ``aggregate() `` method,
106
- ``$changeStreamSplitLargeEvent`` uses the ``watch ()`` method on a
107
- ``Collection `` object .
106
+ ``$changeStreamSplitLargeEvent`` returns an ``AggregationCursor `` when
107
+ passed to the ``aggregate ()`` method and a ``ChangeStreamCursor`` when
108
+ passed to the ``watch() `` method .
108
109
109
110
* - :manual:`$collStats </reference/operator/aggregation/collStats/>`
110
111
- Returns statistics regarding a collection or view.
0 commit comments