node-mongodb-native icon indicating copy to clipboard operation
node-mongodb-native copied to clipboard

refactor: cursor to use fetchBatch function when current batch is empty

Open nbbeeken opened this issue 1 year ago • 0 comments

Description

What is changing?

  • Move next into cursor and rename to fetchBatch
  • Remove transform and blocking flags
  • tryNext/next now call fetchBatch as appropriate to get the same behavior the flags provided
  • move cleanupCursor logic to cleanup()
Is there new documentation needed for these changes?

No

What is the motivation for this change?

The next floating function owned too many details of the implementation of each cursor API, tryNext and next now do a small amount more lifting and we have a fetchBatch method that is focused on obtaining the next batch either with the init command or with a getMore.

Double check the following

  • [x] Ran npm run check:lint script
  • [x] Self-review completed using the steps outlined here
  • [x] PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • [x] Changes are covered by tests
  • [x] New TODOs have a related JIRA ticket

nbbeeken avatar Apr 22 '24 21:04 nbbeeken