Skip to content

Commit ea0c020

Browse files
Docsp 28122 backport v5 (#3204)
* DOCSP-14384 fix first last accumulators (#2231) * Removed first and last array operator topics * Removed links to and array operator topics * Added array behavior to existing and topics * Cleaned up links * Removed includes, started work on making ref sections consistent * Fixed aggregation accumulators landing page entries for first and last * Fixed descriptions for first and last * PR feedback and testing a ref * Updates to link cleanup * Reduced number of links per style guidelines * Parallel cleanup on headings and structure * Latest cleanup on and * Fixed firstN summary in aggregation reference * Committing cleaned branch * Restoring first/last updates to manually back out time series changes * Removed draft content for time series changes * Added first/last accumulator links to ArrayElemAt to replace expression links * Rebuilding * Manual merge resolution * Removed first/last expression listings * Removed first/last expression listings--amend * Rebuild * Broken ref fix
1 parent c6eecab commit ea0c020

File tree

11 files changed

+136
-586
lines changed

11 files changed

+136
-586
lines changed

source/includes/extracts-agg-operators.yaml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ content: |
3131
3232
* - :expression:`$atan2`
3333
- Returns the inverse tangent (arc tangent) of ``y / x`` in
34-
radians, where ``y`` and ``x`` are the first and second
35-
values passed to the expression respectively.
34+
radians, where ``y`` and ``x`` are the first and second values
35+
passed to the expression respectively.
3636
3737
* - :expression:`$asinh`
38-
- Returns the inverse hyperbolic sine (hyperbolic arc sine) of a
39-
value in radians.
38+
- Returns the inverse hyperbolic sine (hyperbolic arc sine) of
39+
a value in radians.
4040
4141
* - :expression:`$acosh`
4242
- Returns the inverse hyperbolic cosine (hyperbolic arc cosine)
@@ -176,10 +176,6 @@ content: |
176176
177177
- Selects a subset of the array to return an array with only
178178
the elements that match the filter condition.
179-
180-
* - :expression:`$first`
181-
182-
- Returns the first array element. Distinct from :group:`$first` accumulator.
183179
184180
* - :expression:`$in`
185181
@@ -196,10 +192,6 @@ content: |
196192
197193
- Determines if the operand is an array. Returns a boolean.
198194
199-
* - :expression:`$last`
200-
201-
- Returns the last array element. Distinct from :group:`$last` accumulator.
202-
203195
* - :expression:`$map`
204196
205197
- Applies a subexpression to each element of an array and
@@ -996,21 +988,17 @@ content: |
996988
997989
* - :group:`$first`
998990
999-
- Returns a value from the first document for each group. Order
1000-
is only defined if the documents are sorted.
1001-
1002-
Distinct from the :expression:`$first` array operator.
991+
- Returns the result of an :ref:`expression
992+
<aggregation-expressions>` for the first document in a group.
1003993
1004994
.. versionchanged:: 5.0
1005995
1006996
Available in the :pipeline:`$setWindowFields` stage.
1007997
1008998
* - :group:`$last`
1009999
1010-
- Returns a value from the last document for each group. Order
1011-
is only defined if the documents are sorted.
1012-
1013-
Distinct from the :expression:`$last` array operator.
1000+
- Returns the result of an :ref:`expression
1001+
<aggregation-expressions>` for the last document in a group.
10141002
10151003
.. versionchanged:: 5.0
10161004
@@ -1092,6 +1080,16 @@ content: |
10921080
- Returns an average of the specified expression or list of
10931081
expressions for each document. Ignores non-numeric values.
10941082
1083+
* - :group:`$first`
1084+
1085+
- Returns the result of an :ref:`expression
1086+
<aggregation-expressions>` for the first document in a group.
1087+
1088+
* - :group:`$last`
1089+
1090+
- Returns the result of an :ref:`expression
1091+
<aggregation-expressions>` for the last document in a group.
1092+
10951093
* - :group:`$max`
10961094
10971095
- Returns the maximum of the specified expression or list of
@@ -1211,9 +1209,9 @@ content: |
12111209
12121210
* - :group:`$first`
12131211
1214-
- Returns the value that results from applying an
1215-
:ref:`expression <aggregation-expressions>` to the first
1216-
document in a group or :ref:`window <setWindowFields-window>`.
1212+
- Returns the result of an :ref:`expression
1213+
<aggregation-expressions>` for the first document in a group
1214+
or :ref:`window <setWindowFields-window>`.
12171215
12181216
.. versionchanged:: 5.0
12191217
@@ -1227,9 +1225,9 @@ content: |
12271225
12281226
* - :group:`$last`
12291227
1230-
- Returns the value that results from applying an
1231-
:ref:`expression <aggregation-expressions>` to the last
1232-
document in a group or :ref:`window <setWindowFields-window>`.
1228+
- Returns the result of an :ref:`expression
1229+
<aggregation-expressions>` for the last document in a group
1230+
or :ref:`window <setWindowFields-window>`.
12331231
12341232
.. versionchanged:: 5.0
12351233

source/includes/note-group-and-window-behavior.rst

Lines changed: 0 additions & 20 deletions
This file was deleted.

source/meta/aggregation-quick-reference.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,7 @@ Index of Expression Operators
374374
- :expression:`$eq`
375375
- :expression:`$exp`
376376
- :expression:`$filter`
377-
- :expression:`$first` (array)
378-
- :group:`$first` (accumulator)
377+
- :group:`$first`
379378
- :expression:`$floor`
380379
- :expression:`$function`
381380
- :expression:`$getField`
@@ -392,8 +391,7 @@ Index of Expression Operators
392391
- :expression:`$isoDayOfWeek`
393392
- :expression:`$isoWeek`
394393
- :expression:`$isoWeekYear`
395-
- :expression:`$last` (array)
396-
- :group:`$last` (accumulator)
394+
- :group:`$last`
397395
- :expression:`$let`
398396
- :expression:`$literal`
399397
- :expression:`$ln`

source/reference/command/collMod.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Definition
1515

1616
.. dbcommand:: collMod
1717

18-
:dbcommand:`collMod` makes it possible to add options to a collection
19-
or to modify view definitions.
18+
:dbcommand:`collMod` makes it possible to add options to a
19+
collection or to modify view definitions.
2020

2121
.. |method| replace:: :method:`~db.collection.hideIndex` and
2222
:method:`~db.collection.unhideIndex` helper methods

source/reference/operator/aggregation.txt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -475,17 +475,6 @@ Alphabetical Listing of Expression Operators
475475
.. versionchanged:: 5.0
476476

477477
Available in :pipeline:`$setWindowFields` stage.
478-
479-
Distinct from the :expression:`$first` array operator.
480-
481-
482-
* - :expression:`$first`
483-
484-
- Returns the first array element.
485-
486-
.. versionadded:: 4.4
487-
488-
Distinct from the :group:`$first` accumulator.
489478

490479
* - :expression:`$floor`
491480

@@ -607,18 +596,6 @@ Alphabetical Listing of Expression Operators
607596
.. versionchanged:: 5.0
608597

609598
Available in :pipeline:`$setWindowFields` stage.
610-
611-
Distinct from the :expression:`$last` array operator.
612-
613-
614-
* - :expression:`$last`
615-
616-
- Returns the last array element.
617-
618-
.. versionadded:: 4.4
619-
620-
Distinct from the :group:`$last` accumulator.
621-
622599

623600
* - :expression:`$let`
624601

@@ -1185,7 +1162,6 @@ Alphabetical Listing of Expression Operators
11851162
/reference/operator/aggregation/expMovingAvg
11861163
/reference/operator/aggregation/filter
11871164
/reference/operator/aggregation/first
1188-
/reference/operator/aggregation/first-array-element
11891165
/reference/operator/aggregation/floor
11901166
/reference/operator/aggregation/function
11911167
/reference/operator/aggregation/getField
@@ -1204,7 +1180,6 @@ Alphabetical Listing of Expression Operators
12041180
/reference/operator/aggregation/isoWeek
12051181
/reference/operator/aggregation/isoWeekYear
12061182
/reference/operator/aggregation/last
1207-
/reference/operator/aggregation/last-array-element
12081183
/reference/operator/aggregation/let
12091184
/reference/operator/aggregation/literal
12101185
/reference/operator/aggregation/ln

source/reference/operator/aggregation/arrayElemAt.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ The operation returns the following results:
112112
See Also
113113
--------
114114

115-
- :expression:`$first`
115+
- :expression:`$slice`
116116

117-
- :expression:`$last`
117+
- :group:`$first`
118118

119-
- :expression:`$slice`
119+
- :group:`$last`
120120

121121
- :ref:`agg-quick-ref-operator-array`

0 commit comments

Comments
 (0)