Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR relaxes the NODE-6878 sharded regression test by removing the CursorResponse.emptyGetMore spy assertion, keeping the test focused on verifying that cursor.rewind() continues to work after the cursor is exhausted via limit.
Changes:
- Removed the
CursorResponse.emptyGetMorespy/assertion from the sharded NODE-6878 regression test. - Updated the test’s inline commentary to account for mongos behavior changes on MongoDB 9.0+.
Comments suppressed due to low confidence (1)
test/integration/crud/find.test.ts:1100
- After rewinding, the test only awaits
cursor.toArray()without asserting anything about the returned documents. This can allow the test to pass even ifrewind()results in an incorrectly empty/partial iteration (as long as no exception is thrown). Consider asserting the expected number of documents (e.g., 3 forlimit: 3) and/or their contents, and updating the test description accordingly since it no longer validatesCursorResponse.emptyGetMorefields.
cursor.rewind();
await cursor.toArray();
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dariakp
requested changes
Apr 10, 2026
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This was referenced Apr 13, 2026
dariakp
approved these changes
Apr 13, 2026
Contributor
|
@tadjik1 There are two failing tests still, do we have known tracking for either of them? The bson tests seem to be running an earlier version of the test - could you check on that? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary of Changes
Remove the
emptyGetMorespy assertion from the NODE-6878 regression test. The test now only verifies thatcursor.rewind()works correctly after cursor exhaustion via limit, which is the actual regression being guarded.Notes for Reviewers
On MongoDB 9.0+, mongos now returns
cursorId: 0on thegetMorethat delivers the final batch when a limit is reached. This means the driver'semptyGetMoreoptimization (which avoids a wasted getMore when the server returns a non-zero cursorId after the limit is satisfied) is never triggered on sharded topologies with 9.0+.The spy assertion required
emptyGetMoreto be called, which can no longer happen on 9.0. The original comment noted that without the spy, "this test always passes, even without the fix in NODE-6878" - that was true because ifemptyGetMorewas never called, the buggy (incomplete) response object was never used, sorewind()would succeed trivially. Now that the NODE-6878 fix is merged andemptyGetMoreis a properCursorResponse, the spy is no longer needed as a guard against a vacuously passing test. The rewind assertion remains meaningful regardless of which code path exhausts the cursor.What is the motivation for this change?
Release Highlight
Release notes highlight
Double check the following
npm run check:lint)type(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript