@@ -1049,7 +1049,6 @@ class UpdateOptions {
10491049 */
10501050 upsert: Optional <Boolean >;
10511051
1052-
10531052 /**
10541053 * Map of parameter names and values. Values must be constant or closed
10551054 * expressions that do not reference document fields. Parameters can then be
@@ -1071,6 +1070,18 @@ class UpdateOptions {
10711070 * and providing one will result in a server-side error.
10721071 */
10731072 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 >;
10741085}
10751086
10761087class ReplaceOptions {
@@ -1139,6 +1150,17 @@ class ReplaceOptions {
11391150 * and providing one will result in a server-side error.
11401151 */
11411152 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 >;
11421164}
11431165
11441166class DeleteOptions {
@@ -1319,6 +1341,17 @@ class ReplaceOneModel implements WriteModel {
13191341 */
13201342 hint: Optional <(String | Document )>;
13211343
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+
13221355 /**
13231356 * When true, creates a new document if no document matches the query.
13241357 *
@@ -1381,6 +1414,17 @@ class UpdateOneModel implements WriteModel {
13811414 */
13821415 hint: Optional <(String | Document )>;
13831416
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+
13841428 /**
13851429 * When true, creates a new document if no document matches the query.
13861430 *
@@ -2430,6 +2474,8 @@ aforementioned allowance in the SemVer spec.
24302474
24312475## Changelog
24322476
2477+ - 2024-10-01: Add sort option to ` replaceOne ` and ` updateOne ` .
2478+
24332479- 2024-09-12: Specify that explain helpers support maxTimeMS.
24342480
24352481- 2024-02-20: Migrated from reStructuredText to Markdown.
0 commit comments