Skip to content

Commit 5966068

Browse files
authored
feat: Add support for MongoDB databaseOptions keys autoSelectFamily, autoSelectFamilyAttemptTimeout (#9579)
1 parent d1f6d3a commit 5966068

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

Diff for: spec/ParseConfigKey.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ describe('Config Keys', () => {
8484
minPoolSize: 5,
8585
connectTimeoutMS: 5000,
8686
socketTimeoutMS: 5000,
87+
autoSelectFamily: true,
88+
autoSelectFamilyAttemptTimeout: 3000
8789
},
8890
})).toBeResolved();
8991
expect(loggerErrorSpy.calls.all().reduce((s, call) => s += call.args[0], '')).not.toMatch(invalidKeyErrorMessage);

Diff for: src/Options/Definitions.js

+12
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,18 @@ module.exports.FileUploadOptions = {
10431043
},
10441044
};
10451045
module.exports.DatabaseOptions = {
1046+
autoSelectFamily: {
1047+
env: 'PARSE_SERVER_DATABASE_AUTO_SELECT_FAMILY',
1048+
help:
1049+
'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.',
1050+
action: parsers.booleanParser,
1051+
},
1052+
autoSelectFamilyAttemptTimeout: {
1053+
env: 'PARSE_SERVER_DATABASE_AUTO_SELECT_FAMILY_ATTEMPT_TIMEOUT',
1054+
help:
1055+
'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.',
1056+
action: parsers.numberParser('autoSelectFamilyAttemptTimeout'),
1057+
},
10461058
connectTimeoutMS: {
10471059
env: 'PARSE_SERVER_DATABASE_CONNECT_TIMEOUT_MS',
10481060
help:

Diff for: src/Options/docs.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/Options/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,10 @@ export interface DatabaseOptions {
610610
connectTimeoutMS: ?number;
611611
/* 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. */
612612
socketTimeoutMS: ?number;
613+
/* 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. */
614+
autoSelectFamily: ?boolean;
615+
/* 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. */
616+
autoSelectFamilyAttemptTimeout: ?number;
613617
}
614618

615619
export interface AuthAdapter {

0 commit comments

Comments
 (0)