-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: Error Handling
-
None
when I do insert_one operation with object
{"key": "1" * 1024 * 1024 * 16}
I will get an error like:
pymongo.errors.WriteError: object to insert too large. size in bytes: 16777248, max size: 16777216
then I do insert_one with
{"key": "1" * 1024 * 1024 * 18}
I will get:
pymongo.errors.DocumentTooLarge: BSON document too large (18874451 bytes) - the connected server supports BSON document sizes up to 16793598 bytes.
I mean, There are two Exceptions with one situation( document is too large). That seems strange.
And there is a similar case on insert_many.
when I set a big document as `doc1`, and do `insert_many([doc1, {}])`, I will get
pymongo.errors.DocumentTooLarge. That seems ok. but when I do `insert_many([{}, doc1])`, I did get `pymongo.errors.AutoReconnect`.
Then I read the source code of pymongo. I do know what is going on now. I just think, could it be better when I meet one kind of situation, I will get only one exception.
- duplicates
-
PYTHON-1365 About DocumentTooLarge
- Closed
- is related to
-
PYTHON-1943 PyMongo does not validate bson document size in OP_MSG bulk writes
- Backlog
-
PYTHON-4085 Inconsistent Exceptions for insert_many([large_doc])
- Backlog