Incorrect limit set when using Int.MaxValue

XMLWordPrintableJSON

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

      We're seeing `BSON field 'batchSize' value must be >= 0, actual value '-2147483648'` when moving from mongo driver 5.3.1 to 5.4.0. We see the same error when using the latest driver version 5.6.0.

      This is with the Scala driver. Reproduce with

       
      "org.mongodb.scala" %% "mongo-scala-driver" % "5.4.0" cross CrossVersion.for3Use2_13

      `collection.find().limit(Int.MaxValue)`

      We've only tested with Scala 3 but I'd imagine other versions will have the same problem as the MaxValue is the same. We're unsure about other drivers. 

      We appreciated that using this value is not a good idea and putting in place our own measures. However we thought this was worth raising an issue for and look forward to your response.

            Assignee:
            Ross Lawley
            Reporter:
            Nick Featch
            Valentin Kavalenka
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: