Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1366

About DocumentTooLarge

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • 5.0
    • 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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            coolxwu Martin Wu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: