@@ -1049,7 +1049,6 @@ class UpdateOptions {
1049
1049
*/
1050
1050
upsert: Optional <Boolean >;
1051
1051
1052
-
1053
1052
/**
1054
1053
* Map of parameter names and values. Values must be constant or closed
1055
1054
* expressions that do not reference document fields. Parameters can then be
@@ -1071,6 +1070,18 @@ class UpdateOptions {
1071
1070
* and providing one will result in a server-side error.
1072
1071
*/
1073
1072
comment: Optional <any >;
1073
+
1074
+ /**
1075
+ * Specify which document the operation updates if the query matches multiple
1076
+ * documents. The first document matched by the sort order will be updated.
1077
+ *
1078
+ * This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1079
+ * The server will report an error if the caller explicitly provides a value with updateMany().
1080
+ * This option is only supported by servers >= 8.0. Older servers will report an error for using this option.
1081
+ *
1082
+ * @see https://www.mongodb.com/docs/manual/reference/command/update/
1083
+ */
1084
+ sort: Optional <Document >;
1074
1085
}
1075
1086
1076
1087
class ReplaceOptions {
@@ -1139,6 +1150,17 @@ class ReplaceOptions {
1139
1150
* and providing one will result in a server-side error.
1140
1151
*/
1141
1152
comment: Optional <any >;
1153
+
1154
+ /**
1155
+ * Specify which document the operation replaces if the query matches multiple
1156
+ * documents. The first document matched by the sort order will be replaced.
1157
+ *
1158
+ * This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1159
+ * This option is only supported by servers >= 8.0. Older servers will report an error for using this option.
1160
+ *
1161
+ * @see https://www.mongodb.com/docs/manual/reference/command/update/
1162
+ */
1163
+ sort: Optional <Document >;
1142
1164
}
1143
1165
1144
1166
class DeleteOptions {
@@ -1319,6 +1341,17 @@ class ReplaceOneModel implements WriteModel {
1319
1341
*/
1320
1342
hint: Optional <(String | Document )>;
1321
1343
1344
+ /**
1345
+ * Specify which document the operation replaces if the query matches multiple
1346
+ * documents. The first document matched by the sort order will be replaced.
1347
+ *
1348
+ * This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1349
+ * This option is only supported by servers >= 8.0. Older servers will report an error for using this option.
1350
+ *
1351
+ * @see https://www.mongodb.com/docs/manual/reference/command/update/
1352
+ */
1353
+ sort: Optional <Document >;
1354
+
1322
1355
/**
1323
1356
* When true, creates a new document if no document matches the query.
1324
1357
*
@@ -1381,6 +1414,17 @@ class UpdateOneModel implements WriteModel {
1381
1414
*/
1382
1415
hint: Optional <(String | Document )>;
1383
1416
1417
+ /**
1418
+ * Specify which document the operation updates if the query matches multiple
1419
+ * documents. The first document matched by the sort order will be updated.
1420
+ *
1421
+ * This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1422
+ * This option is only supported by servers >= 8.0. Older servers will report an error for using this option.
1423
+ *
1424
+ * @see https://www.mongodb.com/docs/manual/reference/command/update/
1425
+ */
1426
+ sort: Optional <Document >;
1427
+
1384
1428
/**
1385
1429
* When true, creates a new document if no document matches the query.
1386
1430
*
@@ -2430,6 +2474,8 @@ aforementioned allowance in the SemVer spec.
2430
2474
2431
2475
## Changelog
2432
2476
2477
+ - 2024-10-01: Add sort option to ` replaceOne ` and ` updateOne ` .
2478
+
2433
2479
- 2024-09-12: Specify that explain helpers support maxTimeMS.
2434
2480
2435
2481
- 2024-02-20: Migrated from reStructuredText to Markdown.
0 commit comments