You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/crud/bulk-write.md
+11-16Lines changed: 11 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -634,22 +634,6 @@ write concern containing the following message:
634
634
635
635
> Cannot request unacknowledged write concern and ordered writes
636
636
637
-
### Size Limits
638
-
639
-
The server reports a `maxBsonObjectSize` in its `hello` response. This value defines the maximum size for documents that
640
-
are inserted into the database. Documents that are sent to the server but are not intended to be inserted into the
641
-
database (e.g. command documents) have a size limit of `maxBsonObjectSize + 16KiB`. When an acknowledged write concern
642
-
is used, drivers MUST NOT perform any checks related to these size limits and MUST rely on the server to raise an error
643
-
if a limit is exceeded. However, when an unacknowledged write concern is used, drivers MUST raise an error if one of the
644
-
following limits is exceeded:
645
-
646
-
- The size of a document to be inserted MUST NOT exceed `maxBsonObjectSize`. This applies to the `document` field of an
647
-
`InsertOneModel` and the `replacement` field of a `ReplaceOneModel`.
648
-
- The size of an entry in the `ops` array MUST NOT exceed `maxBsonObjectSize + 16KiB`.
649
-
- The size of the `bulkWrite` command document MUST NOT exceed `maxBsonObjectSize + 16KiB`.
650
-
651
-
See [SERVER-10643](https://jira.mongodb.org/browse/SERVER-10643) for more details on these size limits.
652
-
653
637
## Auto-Encryption
654
638
655
639
If `MongoClient.bulkWrite` is called on a `MongoClient` configured with `AutoEncryptionOpts`, drivers MUST return an
@@ -922,8 +906,19 @@ number was determined by constructing `OP_MSG` messages with various fields atta
922
906
Drivers are required to use this value even if they are capable of determining the exact size of the message prior to
923
907
batch-splitting to standardize implementations across drivers and simplify batch-splitting testing.
924
908
909
+
### Why is there no requirement to validate the size of a BSON document?
910
+
911
+
Following
912
+
["_Where possible, depend on server to return errors_"](https://github.com/mongodb/specifications/blob/f8dbd2469f18d093f917efa1f758024bca5d3aaa/source/driver-mantras.md#where-possible-depend-on-server-to-return-errors),
913
+
drivers should rely on the server to return errors about exceeded size limits. Such reliance is not possible for
914
+
unacknowledged writes. This specification previously required drivers to check size limits for unacknowledged writes.
915
+
The requirement has since been removed. Checking size limits complicates some driver implementations. Returning a driver
916
+
error in this specific situation does not seem helpful enough to require size checks.
917
+
925
918
## **Changelog**
926
919
920
+
- 2024-11-05: Updated the requirements regarding the size validation.
921
+
927
922
- 2024-10-07: Error if `w:0` is used with `ordered=true` or `verboseResults=true`.
928
923
929
924
- 2024-10-01: Add sort option to `replaceOne` and `updateOne`.
0 commit comments