Skip to content
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

feat: Add support for MongoDB databaseOptions keys autoSelectFamily, autoSelectFamilyAttemptTimeout #9579

Merged
merged 9 commits into from
Jan 30, 2025
2 changes: 2 additions & 0 deletions spec/ParseConfigKey.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ describe('Config Keys', () => {
minPoolSize: 5,
connectTimeoutMS: 5000,
socketTimeoutMS: 5000,
autoSelectFamily: true,
autoSelectFamilyAttemptTimeout: 3000
},
})).toBeResolved();
expect(loggerErrorSpy.calls.all().reduce((s, call) => s += call.args[0], '')).not.toMatch(invalidKeyErrorMessage);
Expand Down
12 changes: 12 additions & 0 deletions src/Options/Definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,18 @@ module.exports.FileUploadOptions = {
},
};
module.exports.DatabaseOptions = {
autoSelectFamily: {
env: 'PARSE_SERVER_DATABASE_AUTO_SELECT_FAMILY',
help:
'The MongoDB driver option to set whether the socket attempts to connect to IPv6 and IPv4 addresses until a connection is established. If available, the driver will select the first IPv6 address.',
action: parsers.booleanParser,
},
autoSelectFamilyAttemptTimeout: {
env: 'PARSE_SERVER_DATABASE_AUTO_SELECT_FAMILY_ATTEMPT_TIMEOUT',
help:
'The MongoDB driver option to specify the amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the autoSelectFamily option. If set to a positive integer less than 10, the value 10 is used instead.',
action: parsers.numberParser('autoSelectFamilyAttemptTimeout'),
},
connectTimeoutMS: {
env: 'PARSE_SERVER_DATABASE_CONNECT_TIMEOUT_MS',
help:
Expand Down
2 changes: 2 additions & 0 deletions src/Options/docs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/Options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,10 @@ export interface DatabaseOptions {
connectTimeoutMS: ?number;
/* The MongoDB driver option to specify the amount of time, in milliseconds, spent attempting to send or receive on a socket before timing out. Specifying 0 means no timeout. */
socketTimeoutMS: ?number;
/* The MongoDB driver option to set whether the socket attempts to connect to IPv6 and IPv4 addresses until a connection is established. If available, the driver will select the first IPv6 address. */
autoSelectFamily: ?boolean;
/* The MongoDB driver option to specify the amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the autoSelectFamily option. If set to a positive integer less than 10, the value 10 is used instead. */
autoSelectFamilyAttemptTimeout: ?number;
}

export interface AuthAdapter {
Expand Down
Loading