Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation consistently applies $eq across affected GridFS operations and includes comprehensive specification coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Aligns GridFS file-ID queries with the updated specification, preventing operator-shaped IDs from being interpreted as query operators.
Changes:
- Wraps GridFS ID matches in
$eqfor downloads, deletes, renames, chunk reads, and upload aborts. - Adds unified and prose coverage for query injection scenarios.
- Synchronizes retryable-read fixtures and GridFS documentation.
| File | Description |
|---|---|
src/gridfs/download.ts |
Uses $eq for file and chunk lookups. |
src/gridfs/index.ts |
Uses $eq for download, delete, and rename filters. |
src/gridfs/upload.ts |
Safely matches chunk IDs during abort cleanup. |
test/integration/gridfs/gridfs.prose.test.ts |
Tests abort cleanup with an operator-shaped ID. |
test/spec/gridfs/README.md |
Adds the new prose test specification. |
test/spec/gridfs/queries-use-eq.yml |
Adds YAML unified tests for $eq behavior. |
test/spec/gridfs/queries-use-eq.json |
Adds equivalent JSON unified tests. |
test/spec/retryable-reads/unified/gridfs-download.yml |
Updates expected download command filters. |
test/spec/retryable-reads/unified/gridfs-download.json |
Updates generated JSON expectations. |
test/spec/retryable-reads/unified/gridfs-download-serverErrors.yml |
Updates server-error retry expectations. |
test/spec/retryable-reads/unified/gridfs-download-serverErrors.json |
Updates generated server-error expectations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
johnmtll
reviewed
Oct 1, 2026
| ? stream.s.filter._id.toString() | ||
| : stream.s.filter.filename; | ||
| const identifier = | ||
| stream.s.filter._id != null ? String(stream.s.filter._id.$eq) : stream.s.filter.filename; |
Contributor
There was a problem hiding this comment.
What's the reason for switching from .toString() to String()? Unlike before, a nullish value now gives "null"/"undefined" instead of throwing.
This branch has not been deployed
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
Sync spec tests and modify query filter format.
What is the motivation for this change?
Align with updated specification.
Double check the following
npm run check:lint)type(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript