Skip to content

feat: Add support for MongoDB databaseOptions keys minPoolSize, connectTimeoutMS, socketTimeoutMS, autoSelectFamily, autoSelectFamilyAttemptTimeout #9577

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

pocketcolin
Copy link
Contributor

Pull Request

Issue

NOTE: This is a clone of #9522 so that the update can go out in 7.x.x in addition to 8.

9523

Closes: 9523

Approach

As discussed in #9211, the decision was made to maintain a list of valid database options for the Parse config that can be passed to MongoDB. There are many options (46 in total) and this PR adds 3 more that I was using. This approach just follows the same approach used in #9213

Tasks

  • Add tests

Copy link

Thanks for opening this pull request!

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.50%. Comparing base (6114cd9) to head (b4364f7).
Report is 5 commits behind head on release-7.x.x.

Additional details and impacted files
@@                Coverage Diff                @@
##           release-7.x.x    #9577      +/-   ##
=================================================
- Coverage          93.51%   93.50%   -0.02%     
=================================================
  Files                186      186              
  Lines              14804    14804              
=================================================
- Hits               13844    13842       -2     
- Misses               960      962       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pocketcolin pocketcolin changed the title feat: Add support for MongoDB databaseOptions keys minPoolSize, connectTimeoutMS, socketTimeoutMS feat: Add support for MongoDB databaseOptions keys minPoolSize, connectTimeoutMS, socketTimeoutMS, autoSelectFamily, autoSelectFamilyAttemptTimeout Jan 29, 2025
Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this PR is not a clone of the Parse Server 8 PR, as there are more options in this PR, is that correct, and if yes, why?

@pocketcolin
Copy link
Contributor Author

pocketcolin commented Jan 29, 2025

@mtrezza because since the Parse Server 8 PR, I found 2 more Mongo settings that are important. Ideally, I think 8 wouldn't validate databaseOptions because there are just too many to maintain, but I'm happy to go back and create another PR for 8 that adds the 2 new ones.

These 2 new fields are really interesting and will help people migrate to Parse 7 as well. The tldr; is that the Node Mongo driver package released a breaking change in a minor release (v6.9) that switched the autoSelectFamily default value to true while it was previously false. Parse 7 updated the Mongo version from 4 to 6.12 so people upgrading to Parse 7 are going to be impacted by this change and without the databaseOption they'll be stuck with a new configuration.

There's a discussion about this here: https://www.mongodb.com/community/forums/t/i-keep-getting-error-when-i-try-connecting-node-to-mongodb/243422/22?page=2

@mtrezza
Copy link
Member

mtrezza commented Jan 29, 2025

It would be great if you could add another PR for Parse Server 8 before we can merge this. The reason is that we aim to back-port identical code, to mitigate divergence in the branches, which would make them more difficult to maintain.

@pocketcolin
Copy link
Contributor Author

Here you are: https://github.com/parse-community/parse-server/pull/9579/files

@mtrezza
Copy link
Member

mtrezza commented Jan 30, 2025

Looks good!

@mtrezza
Copy link
Member

mtrezza commented Jan 30, 2025

We'll merge this after Parse Server 8 release, so that it triggers a new Parse Server 7 release.

@mtrezza
Copy link
Member

mtrezza commented Feb 7, 2025

@pocketcolin Thank you for the PRs, I'll go ahead and merge this, just mind that this won't be part of a Parse Server 7 release yet. But to make it easier for you, you can just point your parse-server dependency to the commit hash on the release-7.x.x branch until a new version has been published - should be in a few days.

@mtrezza mtrezza merged commit 20f2071 into parse-community:release-7.x.x Feb 7, 2025
28 checks passed
@pocketcolin pocketcolin deleted the parse7-databaseOptions branch February 7, 2025 15:09
parseplatformorg pushed a commit that referenced this pull request Mar 12, 2025
# [7.5.0](7.4.0...7.5.0) (2025-03-12)

### Bug Fixes

* LiveQueryServer crashes using cacheAdapter on disconnect from Redis 4 server ([#9615](#9615)) ([0769215](0769215))
* Push adapter not loading on some versions of Node 22 ([#9525](#9525)) ([5447c22](5447c22))
* Security upgrade node from 20.17.0-alpine3.20 to 20.18.2-alpine3.20 ([#9597](#9597)) ([6114cd9](6114cd9))

### Features

* Add support for MongoDB `databaseOptions` keys `minPoolSize`, `connectTimeoutMS`, `socketTimeoutMS`, `autoSelectFamily`, `autoSelectFamilyAttemptTimeout` ([#9577](#9577)) ([20f2071](20f2071))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 7.5.0

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants