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

AsyncBatchCursor when batchSize is 1 terminates prematurely

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.2
    • Component/s: API, Async

      It appears that when using the async Java driver, if you create an AsyncBatchCursor via

      cursor = collection.find(bson).batchSize(1).batchCursor(callback)
      

      specifically using batchSize = 1, the cursor closes after a single call to next(), even when there are multiple elements to return. i.e. the second call to next() results in null. This behaviour is consistent. Changing the batchSize to > 1 resolves the problem.

      I'd be grateful if somebody can confirm they can reproduce this. This looks like something really simple to have been overlooked in testing, so I want to ensure I'm not going nuts!

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            lJoublanc Luciano Joublanc [X]
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: