MongoDB Scala Driver 5.6.0 batchSize defaults to Integer.MIN_VALUE causing BadValue error in MongoDB 8.0.12

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Java Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      When using the MongoDB Scala Driver 5.6.0 with MongoDB Server 8.0.12, queries that do not explicitly set a batchSize result in the driver sending a batchSize value of -2147483648 (i.e., Integer.MIN_VALUE). MongoDB 8.0.12 rejects this value with the following error:

      Command execution failed on MongoDB server with error 2 (BadValue): 'BSON field 'batchSize' value must be >= 0, actual value '-2147483648'' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "BSON field 'batchSize' value must be >= 0, actual value '-2147483648'", "code": 2, "codeName": "BadValue"}

      How to Reproduce

      1. Set up a MongoDB 8.0.12 server.
      1. Use the MongoDB Scala Driver 5.6.0 to perform a query (e.g., find, aggregate, listCollections) without explicitly setting a batchSize.
      1. Observe the error message indicating that the batchSize is invalid.

      Expected Behavior

      The driver should allow MongoDB to use its default behavior when the batchSize is not explicitly set since it arises compatibility issues.

      Environment

      • MongoDB Server: 8.0.12
      • MongoDB Scala Driver: 5.6.0
      • Scala Version: 2.12

            Assignee:
            Ross Lawley
            Reporter:
            Yonca Yunatcı
            None
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: