@@ -12,7 +12,7 @@ Driver CRUD API
12
12
:Status: Approved
13
13
:Type: Standards
14
14
:Minimum Server Version: 2.6
15
- :Last Modified: June 2 , 2021
15
+ :Last Modified: August 31 , 2021
16
16
17
17
.. contents ::
18
18
@@ -946,7 +946,8 @@ Insert, Update, Replace, Delete, and Bulk Writes
946
946
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
947
947
* This option is only supported by servers >= 4.2. Older servers >= 3.4 will report an error for using this option.
948
948
* For servers < 3.4, the driver MUST raise an error if the caller explicitly provides a value.
949
- * For unacknowledged writes using OP_UPDATE or OP_MSG, the driver MUST raise an error if the caller explicitly provides a value.
949
+ * For unacknowledged writes using OP_UPDATE, the driver MUST raise an error if the caller explicitly provides a value.
950
+ * For unacknowledged writes using OP_MSG and servers < 4.2, the driver MUST raise an error if the caller explicitly provides a value.
950
951
*
951
952
* @see https://docs.mongodb.com/manual/reference/command/update/
952
953
*/
@@ -991,7 +992,8 @@ Insert, Update, Replace, Delete, and Bulk Writes
991
992
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
992
993
* This option is only supported by servers >= 4.2. Older servers >= 3.4 will report an error for using this option.
993
994
* For servers < 3.4, the driver MUST raise an error if the caller explicitly provides a value.
994
- * For unacknowledged writes using OP_UPDATE or OP_MSG, the driver MUST raise an error if the caller explicitly provides a value.
995
+ * For unacknowledged writes using OP_UPDATE, the driver MUST raise an error if the caller explicitly provides a value.
996
+ * For unacknowledged writes using OP_MSG and servers < 4.2, the driver MUST raise an error if the caller explicitly provides a value.
995
997
*
996
998
* @see https://docs.mongodb.com/manual/reference/command/update/
997
999
*/
@@ -1027,7 +1029,8 @@ Insert, Update, Replace, Delete, and Bulk Writes
1027
1029
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1028
1030
* This option is only supported by servers >= 4.4. Older servers >= 3.4 will report an error for using this option.
1029
1031
* For servers < 3.4, the driver MUST raise an error if the caller explicitly provides a value.
1030
- * For unacknowledged writes using OP_DELETE or OP_MSG, the driver MUST raise an error if the caller explicitly provides a value.
1032
+ * For unacknowledged writes using OP_DELETE, the driver MUST raise an error if the caller explicitly provides a value.
1033
+ * For unacknowledged writes using OP_MSG and servers < 4.4, the driver MUST raise an error if the caller explicitly provides a value.
1031
1034
*
1032
1035
* @see https://docs.mongodb.com/manual/reference/command/delete/
1033
1036
*/
@@ -1081,7 +1084,8 @@ Bulk Write Models
1081
1084
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1082
1085
* This option is only supported by servers >= 4.4. Older servers >= 3.4 will report an error for using this option.
1083
1086
* For servers < 3.4, the driver MUST raise an error if the caller explicitly provides a value.
1084
- * For unacknowledged writes using OP_DELETE or OP_MSG, the driver MUST raise an error if the caller explicitly provides a value.
1087
+ * For unacknowledged writes using OP_DELETE, the driver MUST raise an error if the caller explicitly provides a value.
1088
+ * For unacknowledged writes using OP_MSG and servers < 4.4, the driver MUST raise an error if the caller explicitly provides a value.
1085
1089
*
1086
1090
* @see https://docs.mongodb.com/manual/reference/command/delete/
1087
1091
*/
@@ -1156,7 +1160,8 @@ Bulk Write Models
1156
1160
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1157
1161
* This option is only supported by servers >= 4.2. Older servers >= 3.4 will report an error for using this option.
1158
1162
* For servers < 3.4, the driver MUST raise an error if the caller explicitly provides a value.
1159
- * For unacknowledged writes using OP_UPDATE or OP_MSG, the driver MUST raise an error if the caller explicitly provides a value.
1163
+ * For unacknowledged writes using OP_UPDATE, the driver MUST raise an error if the caller explicitly provides a value.
1164
+ * For unacknowledged writes using OP_MSG and servers < 4.2, the driver MUST raise an error if the caller explicitly provides a value.
1160
1165
*
1161
1166
* @see https://docs.mongodb.com/manual/reference/command/update/
1162
1167
*/
@@ -1217,7 +1222,8 @@ Bulk Write Models
1217
1222
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1218
1223
* This option is only supported by servers >= 4.2. Older servers >= 3.4 will report an error for using this option.
1219
1224
* For servers < 3.4, the driver MUST raise an error if the caller explicitly provides a value.
1220
- * For unacknowledged writes using OP_UPDATE or OP_MSG, the driver MUST raise an error if the caller explicitly provides a value.
1225
+ * For unacknowledged writes using OP_UPDATE, the driver MUST raise an error if the caller explicitly provides a value.
1226
+ * For unacknowledged writes using OP_MSG and servers < 4.2, the driver MUST raise an error if the caller explicitly provides a value.
1221
1227
*
1222
1228
* @see https://docs.mongodb.com/manual/reference/command/update/
1223
1229
*/
@@ -1278,7 +1284,8 @@ Bulk Write Models
1278
1284
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1279
1285
* This option is only supported by servers >= 4.2. Older servers >= 3.4 will report an error for using this option.
1280
1286
* For servers < 3.4, the driver MUST raise an error if the caller explicitly provides a value.
1281
- * For unacknowledged writes using OP_UPDATE or OP_MSG, the driver MUST raise an error if the caller explicitly provides a value.
1287
+ * For unacknowledged writes using OP_UPDATE, the driver MUST raise an error if the caller explicitly provides a value.
1288
+ * For unacknowledged writes using OP_MSG and servers < 4.2, the driver MUST raise an error if the caller explicitly provides a value.
1282
1289
*
1283
1290
* @see https://docs.mongodb.com/manual/reference/command/update/
1284
1291
*/
@@ -1699,7 +1706,7 @@ Find And Modify
1699
1706
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1700
1707
* This option is only supported by servers >= 4.4. Older servers >= 4.2 will report an error for using this option.
1701
1708
* For servers < 4.2, the driver MUST raise an error if the caller explicitly provides a value.
1702
- * For unacknowledged writes using OP_MSG , the driver MUST raise an error if the caller explicitly provides a value.
1709
+ * For unacknowledged writes and servers < 4.4 , the driver MUST raise an error if the caller explicitly provides a value.
1703
1710
*
1704
1711
* @see https://docs.mongodb.com/manual/reference/command/findAndModify/
1705
1712
*/
@@ -1762,7 +1769,7 @@ Find And Modify
1762
1769
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1763
1770
* This option is only supported by servers >= 4.4. Older servers >= 4.2 will report an error for using this option.
1764
1771
* For servers < 4.2, the driver MUST raise an error if the caller explicitly provides a value.
1765
- * For unacknowledged writes using OP_MSG , the driver MUST raise an error if the caller explicitly provides a value.
1772
+ * For unacknowledged writes and servers < 4.4 , the driver MUST raise an error if the caller explicitly provides a value.
1766
1773
*
1767
1774
* @see https://docs.mongodb.com/manual/reference/command/findAndModify/
1768
1775
*/
@@ -1856,7 +1863,7 @@ Find And Modify
1856
1863
* This option is sent only if the caller explicitly provides a value. The default is to not send a value.
1857
1864
* This option is only supported by servers >= 4.4. Older servers >= 4.2 will report an error for using this option.
1858
1865
* For servers < 4.2, the driver MUST raise an error if the caller explicitly provides a value.
1859
- * For unacknowledged writes using OP_MSG , the driver MUST raise an error if the caller explicitly provides a value.
1866
+ * For unacknowledged writes and servers < 4.4 , the driver MUST raise an error if the caller explicitly provides a value.
1860
1867
*
1861
1868
* @see https://docs.mongodb.com/manual/reference/command/findAndModify/
1862
1869
*/
@@ -2014,12 +2021,10 @@ Q: Where is ``singleBatch`` in FindOptions?
2014
2021
Q: Why are client-side errors raised for some unsupported options?
2015
2022
Server versions before 3.4 were inconsistent about reporting errors for unrecognized command options and may simply ignore them, which means a client-side error is the only way to inform users that such options are unsupported. For unacknowledged writes using OP_MSG, a client-side error is necessary because the server has no chance to return a response (even though a 3.6+ server is otherwise capable of reporting errors for unrecognized options). For unacknowledged writes using legacy opcodes (i.e. OP_INSERT, OP_UPDATE, and OP_DELETE), the message body has no field with which to express these options so a client-side error is the only mechanism to inform the user that such options are unsupported. The spec does not explicitly refer to unacknowledged writes using OP_QUERY primarily because a response document is always returned and drivers generally would not consider using OP_QUERY precisely for that reason.
2016
2023
2017
- Q: Why are client-side errors raised when options are provided for unacknowledged write operations, even on server versions that support those options?
2018
- Even if the server supports an option, that option could be incorrectly formatted or contain outdated information (e.g. a "hint" option referencing an index that no longer exists). This is a problem during unacknowledged writes because the server cannot return an error response to alert the client of an incorrect option. By always raising a client-side error when options are specified for unacknowledged writes, users are prevented from performing operations with options that do not work.
2019
-
2020
2024
Changes
2021
2025
=======
2022
2026
2027
+ * 2021-08-31: Allow unacknowledged hints on write operations if supported by server (reverts previous change).
2023
2028
* 2021-06-02: Introduce WriteError.details and clarify WriteError construction
2024
2029
* 2021-06-01: Add let to AggregateOptions
2025
2030
* 2021-01-21: Update estimatedDocumentCount to use $collStats stage for servers >= 4.9
0 commit comments