-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix: GridFSBucketAdapter throws when using some Parse Server specific options in MongoDB database options
#9915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🚀 Thanks for opening this pull request! |
📝 WalkthroughWalkthroughReplaces hard-coded Parse Server-specific MongoDB option removals with a shared exported Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller as Adapter Init
participant Adapter as Mongo/GridFS Adapter
participant Defaults as src/defaults.js
participant Mongo as MongoClient
Caller->>Adapter: new Adapter(mongoOptions)
Adapter->>Defaults: import ParseServerDatabaseOptions
Adapter->>Adapter: this._mongoOptions = {...mongoOptions} %% shallow copy
Adapter->>Defaults: for each key in ParseServerDatabaseOptions
Adapter->>Adapter: delete this._mongoOptions[key] %% remove server-only keys
Adapter->>Mongo: connect(this._mongoOptions) %% pass filtered options
Mongo-->>Adapter: connection established
Adapter-->>Caller: adapter ready
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/Adapters/Files/GridFSBucketAdapter.js (1)
40-56: LGTM! Consider alphabetical ordering for maintainability.The expanded filtering correctly removes Parse Server-specific options before passing configuration to
MongoClient.connect. The implementation matches the test coverage inGridFSBucketStorageAdapter.spec.js.For improved maintainability, consider alphabetizing the options array:
- for (const key of [ - 'allowPublicExplain', - 'enableSchemaHooks', - 'schemaCacheTtl', - 'maxTimeMS', - 'disableIndexFieldValidation', - 'logClientEvents', - 'createIndexUserUsername', - 'createIndexUserUsernameCaseInsensitive', - 'createIndexUserEmail', - 'createIndexUserEmailCaseInsensitive', - 'createIndexUserEmailVerifyToken', - 'createIndexUserPasswordResetToken', - 'createIndexRoleName', - ]) { + for (const key of [ + 'allowPublicExplain', + 'createIndexRoleName', + 'createIndexUserEmail', + 'createIndexUserEmailCaseInsensitive', + 'createIndexUserEmailVerifyToken', + 'createIndexUserPasswordResetToken', + 'createIndexUserUsername', + 'createIndexUserUsernameCaseInsensitive', + 'disableIndexFieldValidation', + 'enableSchemaHooks', + 'logClientEvents', + 'maxTimeMS', + 'schemaCacheTtl', + ]) { delete _mongoOptions[key]; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
spec/GridFSBucketStorageAdapter.spec.js(1 hunks)src/Adapters/Files/GridFSBucketAdapter.js(1 hunks)types/Options/index.d.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 0
File: :0-0
Timestamp: 2025-11-08T13:46:04.917Z
Learning: When reviewing Parse Server PRs that add new features, always check whether the feature is documented in the README.md file, though for new Parse Server options this is optional rather than required.
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 0
File: :0-0
Timestamp: 2025-11-08T13:46:04.917Z
Learning: For new Parse Server options, verify that the option is documented in src/Options/index.js and that npm run definitions has been executed to reflect changes in src/Options/docs.js and src/Options/Definitions.js. README.md documentation is a bonus but not required for new options.
Learnt from: EmpiDev
Repo: parse-community/parse-server PR: 9770
File: spec/CloudCode.spec.js:446-469
Timestamp: 2025-08-26T14:06:31.853Z
Learning: In the Parse Server codebase, when handling query objects in maybeRunAfterFindTrigger, objects without a where property that contain options like limit/skip should be treated as query JSON with an empty where clause using the spread pattern { where: {}, ...query }, not nested as { where: query }.
📚 Learning: 2025-11-08T13:46:04.917Z
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 0
File: :0-0
Timestamp: 2025-11-08T13:46:04.917Z
Learning: For new Parse Server options, verify that the option is documented in src/Options/index.js and that npm run definitions has been executed to reflect changes in src/Options/docs.js and src/Options/Definitions.js. README.md documentation is a bonus but not required for new options.
Applied to files:
src/Adapters/Files/GridFSBucketAdapter.jstypes/Options/index.d.tsspec/GridFSBucketStorageAdapter.spec.js
📚 Learning: 2025-11-08T13:46:04.917Z
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 0
File: :0-0
Timestamp: 2025-11-08T13:46:04.917Z
Learning: When reviewing Parse Server PRs that add new features, always check whether the feature is documented in the README.md file, though for new Parse Server options this is optional rather than required.
Applied to files:
spec/GridFSBucketStorageAdapter.spec.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: PostgreSQL 16, PostGIS 3.5
- GitHub Check: PostgreSQL 18, PostGIS 3.6
- GitHub Check: Node 22
- GitHub Check: MongoDB 6, ReplicaSet
- GitHub Check: PostgreSQL 17, PostGIS 3.5
- GitHub Check: Node 20
- GitHub Check: MongoDB 8, ReplicaSet
- GitHub Check: MongoDB 7, ReplicaSet
- GitHub Check: PostgreSQL 15, PostGIS 3.3
- GitHub Check: PostgreSQL 15, PostGIS 3.4
- GitHub Check: Node 18
- GitHub Check: PostgreSQL 15, PostGIS 3.5
- GitHub Check: Redis Cache
- GitHub Check: Docker Build
🔇 Additional comments (1)
spec/GridFSBucketStorageAdapter.spec.js (1)
23-47: LGTM! Comprehensive test coverage for filtered options.The test effectively verifies that:
- Parse Server-specific options can be passed to GridFSBucketAdapter without causing errors
- These options are filtered out before reaching the MongoDB client
- Valid MongoDB options (like
retryWrites) are properly passed through to the database connectionThe updated comment on line 27 clearly documents the purpose of these options.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #9915 +/- ##
=======================================
Coverage 93.07% 93.07%
=======================================
Files 187 187
Lines 15223 15224 +1
Branches 177 177
=======================================
+ Hits 14169 14170 +1
Misses 1042 1042
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# [8.5.0-alpha.6](8.5.0-alpha.5...8.5.0-alpha.6) (2025-11-08) ### Bug Fixes * `GridFSBucketAdapter` throws when using some Parse Server specific options in MongoDB database options ([#9915](#9915)) ([d3d4003](d3d4003))
|
🎉 This change has been released in version 8.5.0-alpha.6 |
Pull Request
Issue
MongoStorageAdapterandGridFSBucketAdapterboth pass thedatabaseOptionsto the MongoDB client. ThedatabaseOptionsinclude both native MongoDB driver options and Parse Server custom options that need to be filtered out because the MongoDB client would reject them.The list of options that must be filtered out before passing to MongoDB client is defined separately in
MongoStorageAdapterandGridFSBucketAdapter. The list forGridFSBucketAdapterhasn't been updated in a while, so it passes a few options to the client that should be filtered out.Approach
Tasks
Summary by CodeRabbit
Bug Fixes
New Features