Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-91778

Do not close cursor in the shell when cursor reaches limit

    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0, v6.0, v5.0
    • QE 2024-07-08

      The tests exhaust.js fails when sbe is enabled and when the number of docs to return is equal to the batchSize. SBE requires one additional getMore call to fully exhaust the cursor. However, in the shell, the hasNext method https://github.com/10gen/mongo/blob/master/src/mongo/shell/query.js/#L244 closes the cursor when the cursor has seen limit docs. The cursor still has the moreToCome bit set and returns information about this cursor when the next query is called. The shell should not close the cursor in this case. The server already handles exhaust cursors properly: only closes them once moreToCome is unset. 

            Assignee:
            adi.agrawal@mongodb.com Adi Agrawal
            Reporter:
            adi.agrawal@mongodb.com Adi Agrawal
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: