Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2533

Add type-safe way to detect max document size exceeded

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7.0
    • Affects Version/s: 3.4.2
    • Component/s: BSON
    • Labels:
      None

      Add a type-safe way for applications to detect that a BSON document failed to serialize due to the maximum document size supported by MongoDB being exceeded. Possibilities include:

      • adding an enumeration to BsonSerializationException
      • adding a new exception type, e.g. BsonMaximumDocumentSizeExceedException

      Original Description

      While catching an exception for the error "MaxDocumentSize exceeded...", per this ref, the errorCode is not populated.

      It would appear that the BsonSerializationException constructor only accepts strings, while its superclass BSONException can accept both string and a code (among its four constructors).

      Looking further at the source for BsonSerializationException, all it does is call super(message) and nothing else.

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            luke.prochazka@mongodb.com Luke Prochazka
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: