@@ -930,6 +930,8 @@ content: |
930
930
ref : agg-operators-accumulators-group
931
931
content : |
932
932
933
+ .. versionchanged:: 5.0
934
+
933
935
.. list-table::
934
936
:header-rows: 1
935
937
:widths: 20 80
@@ -943,36 +945,62 @@ content: |
943
945
944
946
* - :group:`$addToSet`
945
947
946
- - Returns an array of *unique* expression values for each
947
- group. Order of the array elements is undefined.
948
+ - Returns an array of *unique* expression values for each group.
949
+ Order of the array elements is undefined.
950
+
951
+ .. versionchanged:: 5.0
952
+
953
+ Available in :pipeline:`$setWindowFields` stage.
948
954
949
955
* - :group:`$avg`
950
956
951
957
- Returns an average of numerical values. Ignores non-numeric values.
952
958
959
+ .. versionchanged:: 5.0
960
+
961
+ Available in :pipeline:`$setWindowFields` stage.
962
+
953
963
* - :group:`$count`
954
964
955
- - Returns the count of the documents in the stage. May be used in
956
- place of ``{ $sum : 1 }``.
965
+ - Returns the number of documents in a group.
966
+
967
+ Distinct from the :pipeline:`$count` pipeline stage.
968
+
969
+ .. versionadded:: 5.0
970
+
971
+ Available in :pipeline:`$group` and
972
+ :pipeline:`$setWindowFields` stages.
957
973
958
974
* - :group:`$first`
959
975
960
976
- Returns a value from the first document for each group. Order
961
- is only defined if the documents are in a defined order .
977
+ is only defined if the documents are sorted .
962
978
963
979
Distinct from the :expression:`$first` array operator.
964
980
981
+ .. versionchanged:: 5.0
982
+
983
+ Available in :pipeline:`$setWindowFields` stage.
984
+
965
985
* - :group:`$last`
966
986
967
987
- Returns a value from the last document for each group. Order
968
- is only defined if the documents are in a defined order .
988
+ is only defined if the documents are sorted .
969
989
970
990
Distinct from the :expression:`$last` array operator.
971
991
992
+ .. versionchanged:: 5.0
993
+
994
+ Available in :pipeline:`$setWindowFields` stage.
995
+
972
996
* - :group:`$max`
973
997
974
998
- Returns the highest expression value for each group.
975
999
1000
+ .. versionchanged:: 5.0
1001
+
1002
+ Available in :pipeline:`$setWindowFields` stage.
1003
+
976
1004
* - :expression:`$mergeObjects`
977
1005
978
1006
- Returns a document created by combining the input documents
@@ -982,32 +1010,52 @@ content: |
982
1010
983
1011
- Returns the lowest expression value for each group.
984
1012
1013
+ .. versionchanged:: 5.0
1014
+
1015
+ Available in :pipeline:`$setWindowFields` stage.
1016
+
985
1017
* - :group:`$push`
986
1018
987
- - Returns an array of expression values for each group.
1019
+ - Returns an array of expression values for documents in each
1020
+ group.
1021
+
1022
+ .. versionchanged:: 5.0
988
1023
1024
+ Available in :pipeline:`$setWindowFields` stage.
989
1025
990
1026
* - :group:`$stdDevPop`
991
1027
992
1028
- Returns the population standard deviation of the input values.
993
1029
1030
+ .. versionchanged:: 5.0
1031
+
1032
+ Available in :pipeline:`$setWindowFields` stage.
1033
+
994
1034
* - :group:`$stdDevSamp`
995
1035
996
1036
- Returns the sample standard deviation of the input values.
997
1037
1038
+ .. versionchanged:: 5.0
1039
+
1040
+ Available in :pipeline:`$setWindowFields` stage.
1041
+
998
1042
* - :group:`$sum`
999
1043
1000
1044
- Returns a sum of numerical values. Ignores non-numeric values.
1001
1045
1046
+ .. versionchanged:: 5.0
1047
+
1048
+ Available in :pipeline:`$setWindowFields` stage.
1002
1049
1003
1050
---
1004
1051
ref : agg-operators-accumulators-project
1005
1052
content : |
1006
1053
1007
- .. versionchanged:: 3.2
1054
+ .. versionchanged:: 5.0
1008
1055
1009
1056
The following accumulator operators are also available in the
1010
- :pipeline:`$project`, :pipeline:`$addFields`, and :pipeline:`$set` stages.
1057
+ :pipeline:`$project`, :pipeline:`$addFields`, :pipeline:`$set`, and,
1058
+ starting in MongoDB 5.0, the :pipeline:`$setWindowFields` stages.
1011
1059
1012
1060
.. list-table::
1013
1061
:header-rows: 1
@@ -1021,7 +1069,6 @@ content: |
1021
1069
- Returns an average of the specified expression or list of
1022
1070
expressions for each document. Ignores non-numeric values.
1023
1071
1024
-
1025
1072
* - :group:`$max`
1026
1073
1027
1074
- Returns the maximum of the specified expression or list of
@@ -1044,4 +1091,200 @@ content: |
1044
1091
1045
1092
- Returns a sum of numerical values. Ignores non-numeric values.
1046
1093
1094
+ ---
1095
+ ref : agg-operators-window
1096
+ content : |
1097
+
1098
+ .. versionadded:: 5.0
1099
+
1100
+ Window operators return values from a defined span of documents from
1101
+ a collection, known as a *window*. A :ref:`window
1102
+ <setWindowFields-window>` is defined in the
1103
+ :pipeline:`$setWindowFields` stage, available starting in MongoDB
1104
+ 5.0.
1105
+
1106
+ The following window operators are available in the
1107
+ :pipeline:`$setWindowFields` stage.
1108
+
1109
+ .. list-table::
1110
+ :header-rows: 1
1111
+ :widths: 20 80
1112
+
1113
+ * - Name
1114
+ - Description
1115
+
1116
+ * - :group:`$addToSet`
1117
+
1118
+ - Returns an array of all unique values that results from
1119
+ applying an :ref:`expression <aggregation-expressions>` to
1120
+ each document.
1121
+
1122
+ .. versionchanged:: 5.0
1123
+
1124
+ Available in :pipeline:`$setWindowFields` stage.
1125
+
1126
+ * - :group:`$avg`
1127
+
1128
+ - Returns the average for the specified :ref:`expression
1129
+ <aggregation-expressions>`. Ignores non-numeric values.
1130
+
1131
+ .. versionchanged:: 5.0
1132
+
1133
+ Available in :pipeline:`$setWindowFields` stage.
1134
+
1135
+ * - :group:`$count`
1136
+
1137
+ - Returns the number of documents in the group or window.
1138
+
1139
+ Distinct from the :pipeline:`$count` pipeline stage.
1140
+
1141
+ .. versionadded:: 5.0
1142
+
1143
+ * - :group:`$covariancePop`
1144
+
1145
+ - Returns the population covariance of two numeric
1146
+ :ref:`expressions <aggregation-expressions>`.
1147
+
1148
+ .. versionadded:: 5.0
1149
+
1150
+ * - :group:`$covarianceSamp`
1151
+
1152
+ - Returns the sample covariance of two numeric
1153
+ :ref:`expressions <aggregation-expressions>`.
1154
+
1155
+ .. versionadded:: 5.0
1156
+
1157
+ * - :group:`$denseRank`
1158
+
1159
+ - Returns the document position (known as the rank) relative to
1160
+ other documents in the :pipeline:`$setWindowFields` stage
1161
+ :ref:`partition <setWindowFields-partitionBy>`. There are no
1162
+ gaps in the ranks. Ties receive the same rank.
1163
+
1164
+ .. versionadded:: 5.0
1165
+
1166
+ * - :group:`$derivative`
1167
+
1168
+ - Returns the mathematical derivative of the numeric
1169
+ :ref:`expression <aggregation-expressions>`.
1170
+
1171
+ .. versionadded:: 5.0
1172
+
1173
+ * - :group:`$documentNumber`
1174
+
1175
+ - Returns the position of a document (known as the document
1176
+ number) in the :pipeline:`$setWindowFields` stage
1177
+ :ref:`partition <setWindowFields-partitionBy>`. Ties result in
1178
+ different adjacent document numbers.
1179
+
1180
+ .. versionadded:: 5.0
1181
+
1182
+ * - :group:`$expMovingAvg`
1183
+
1184
+ - Returns the exponential moving average for the numeric
1185
+ :ref:`expression <aggregation-expressions>`.
1186
+
1187
+ .. versionadded:: 5.0
1188
+
1189
+ * - :group:`$first`
1190
+
1191
+ - Returns the value that results from applying an
1192
+ :ref:`expression <aggregation-expressions>` to the first
1193
+ document in a group or :ref:`window <setWindowFields-window>`.
1194
+
1195
+ .. versionchanged:: 5.0
1196
+
1197
+ Available in :pipeline:`$setWindowFields` stage.
1198
+
1199
+ * - :group:`$integral`
1200
+
1201
+ - Returns the mathematical integral of the numeric
1202
+ :ref:`expression <aggregation-expressions>`.
1203
+
1204
+ .. versionadded:: 5.0
1205
+
1206
+ * - :group:`$last`
1207
+
1208
+ - Returns the value that results from applying an
1209
+ :ref:`expression <aggregation-expressions>` to the last
1210
+ document in a group or :ref:`window <setWindowFields-window>`.
1211
+
1212
+ .. versionchanged:: 5.0
1213
+
1214
+ Available in :pipeline:`$setWindowFields` stage.
1215
+
1216
+ * - :group:`$max`
1217
+
1218
+ - Returns the maximum value that results from applying an
1219
+ :ref:`expression <aggregation-expressions>` to each document.
1220
+
1221
+ .. versionchanged:: 5.0
1222
+
1223
+ Available in :pipeline:`$setWindowFields` stage.
1224
+
1225
+ * - :group:`$min`
1226
+
1227
+ - Returns the minimum value that results from applying an
1228
+ :ref:`expression <aggregation-expressions>` to each document.
1229
+
1230
+ .. versionchanged:: 5.0
1231
+
1232
+ Available in :pipeline:`$setWindowFields` stage.
1233
+
1234
+ * - :group:`$push`
1235
+
1236
+ - Returns an array of values that result from applying an
1237
+ :ref:`expression <aggregation-expressions>` to each document.
1238
+
1239
+ .. versionchanged:: 5.0
1240
+
1241
+ Available in :pipeline:`$setWindowFields` stage.
1242
+
1243
+ * - :group:`$rank`
1244
+
1245
+ - Returns the document position (known as the rank) relative to
1246
+ other documents in the :pipeline:`$setWindowFields` stage
1247
+ :ref:`partition <setWindowFields-partitionBy>`.
1248
+
1249
+ .. versionadded:: 5.0
1250
+
1251
+ * - :group:`$shift`
1252
+
1253
+ - Returns the value from an :ref:`expression
1254
+ <aggregation-expressions>` applied to a document in a
1255
+ specified position relative to the current document in the
1256
+ :pipeline:`$setWindowFields` stage :ref:`partition
1257
+ <setWindowFields-partitionBy>`.
1258
+
1259
+ .. versionadded:: 5.0
1260
+
1261
+ * - :group:`$stdDevPop`
1262
+
1263
+ - Returns the population standard deviation that results from
1264
+ applying a numeric :ref:`expression <aggregation-expressions>`
1265
+ to each document.
1266
+
1267
+ .. versionchanged:: 5.0
1268
+
1269
+ Available in :pipeline:`$setWindowFields` stage.
1270
+
1271
+ * - :group:`$stdDevSamp`
1272
+
1273
+ - Returns the sample standard deviation that results from
1274
+ applying a numeric :ref:`expression <aggregation-expressions>`
1275
+ to each document.
1276
+
1277
+ .. versionchanged:: 5.0
1278
+
1279
+ Available in :pipeline:`$setWindowFields` stage.
1280
+
1281
+ * - :group:`$sum`
1282
+
1283
+ - Returns the sum that results from applying a numeric
1284
+ :ref:`expression <aggregation-expressions>` to each document.
1285
+
1286
+ .. versionchanged:: 5.0
1287
+
1288
+ Available in :pipeline:`$setWindowFields` stage.
1289
+
1047
1290
...
0 commit comments