diff --git a/spec/ParseConfigKey.spec.js b/spec/ParseConfigKey.spec.js
index ae31ff954d..dcc51d5c7d 100644
--- a/spec/ParseConfigKey.spec.js
+++ b/spec/ParseConfigKey.spec.js
@@ -78,6 +78,9 @@ describe('Config Keys', () => {
maxStalenessSeconds: 10,
maxPoolSize: 10,
minPoolSize: 5,
+ serverSelectionTimeoutMS: 5000,
+ maxIdleTimeMS: 60000,
+ heartbeatFrequencyMS: 10000,
connectTimeoutMS: 5000,
socketTimeoutMS: 5000,
autoSelectFamily: true,
diff --git a/src/Options/Definitions.js b/src/Options/Definitions.js
index 6c91b1c42c..74fc31a9bc 100644
--- a/src/Options/Definitions.js
+++ b/src/Options/Definitions.js
@@ -1164,6 +1164,18 @@ module.exports.DatabaseOptions = {
action: parsers.booleanParser,
default: false,
},
+ heartbeatFrequencyMS: {
+ env: 'PARSE_SERVER_DATABASE_HEARTBEAT_FREQUENCY_MS',
+ help:
+ 'The MongoDB driver option to specify the frequency in milliseconds at which the driver checks the state of the MongoDB deployment.',
+ action: parsers.numberParser('heartbeatFrequencyMS'),
+ },
+ maxIdleTimeMS: {
+ env: 'PARSE_SERVER_DATABASE_MAX_IDLE_TIME_MS',
+ help:
+ 'The MongoDB driver option to specify the amount of time in milliseconds that a connection can remain idle in the connection pool before being removed and closed.',
+ action: parsers.numberParser('maxIdleTimeMS'),
+ },
maxPoolSize: {
env: 'PARSE_SERVER_DATABASE_MAX_POOL_SIZE',
help:
@@ -1199,6 +1211,12 @@ module.exports.DatabaseOptions = {
'The duration in seconds after which the schema cache expires and will be refetched from the database. Use this option if using multiple Parse Servers instances connected to the same database. A low duration will cause the schema cache to be updated too often, causing unnecessary database reads. A high duration will cause the schema to be updated too rarely, increasing the time required until schema changes propagate to all server instances. This feature can be used as an alternative or in conjunction with the option `enableSchemaHooks`. Default is infinite which means the schema cache never expires.',
action: parsers.numberParser('schemaCacheTtl'),
},
+ serverSelectionTimeoutMS: {
+ env: 'PARSE_SERVER_DATABASE_SERVER_SELECTION_TIMEOUT_MS',
+ help:
+ 'The MongoDB driver option to specify the amount of time in milliseconds for a server to be considered suitable for selection.',
+ action: parsers.numberParser('serverSelectionTimeoutMS'),
+ },
socketTimeoutMS: {
env: 'PARSE_SERVER_DATABASE_SOCKET_TIMEOUT_MS',
help:
diff --git a/src/Options/docs.js b/src/Options/docs.js
index cbe3efbf39..00b9634bb0 100644
--- a/src/Options/docs.js
+++ b/src/Options/docs.js
@@ -252,12 +252,15 @@
* @property {Boolean} createIndexUserUsernameCaseInsensitive Set to `true` to automatically create a case-insensitive index on the username field of the _User collection on server start. Set to `false` to skip index creation. Default is `true`.
⚠️ When setting this option to `false` to manually create the index, keep in mind that the otherwise automatically created index may change in the future to be optimized for the internal usage by Parse Server.
* @property {Boolean} disableIndexFieldValidation Set to `true` to disable validation of index fields. When disabled, indexes can be created even if the fields do not exist in the schema. This can be useful when creating indexes on fields that will be added later.
* @property {Boolean} enableSchemaHooks Enables database real-time hooks to update single schema cache. Set to `true` if using multiple Parse Servers instances connected to the same database. Failing to do so will cause a schema change to not propagate to all instances and re-syncing will only happen when the instances restart. To use this feature with MongoDB, a replica set cluster with [change stream](https://docs.mongodb.com/manual/changeStreams/#availability) support is required.
+ * @property {Number} heartbeatFrequencyMS The MongoDB driver option to specify the frequency in milliseconds at which the driver checks the state of the MongoDB deployment.
+ * @property {Number} maxIdleTimeMS The MongoDB driver option to specify the amount of time in milliseconds that a connection can remain idle in the connection pool before being removed and closed.
* @property {Number} maxPoolSize The MongoDB driver option to set the maximum number of opened, cached, ready-to-use database connections maintained by the driver.
* @property {Number} maxStalenessSeconds The MongoDB driver option to set the maximum replication lag for reads from secondary nodes.
* @property {Number} maxTimeMS The MongoDB driver option to set a cumulative time limit in milliseconds for processing operations on a cursor.
* @property {Number} minPoolSize The MongoDB driver option to set the minimum number of opened, cached, ready-to-use database connections maintained by the driver.
* @property {Boolean} retryWrites The MongoDB driver option to set whether to retry failed writes.
* @property {Number} schemaCacheTtl The duration in seconds after which the schema cache expires and will be refetched from the database. Use this option if using multiple Parse Servers instances connected to the same database. A low duration will cause the schema cache to be updated too often, causing unnecessary database reads. A high duration will cause the schema to be updated too rarely, increasing the time required until schema changes propagate to all server instances. This feature can be used as an alternative or in conjunction with the option `enableSchemaHooks`. Default is infinite which means the schema cache never expires.
+ * @property {Number} serverSelectionTimeoutMS The MongoDB driver option to specify the amount of time in milliseconds for a server to be considered suitable for selection.
* @property {Number} socketTimeoutMS 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.
*/
diff --git a/src/Options/index.js b/src/Options/index.js
index 54195a8c52..11908ae1cc 100644
--- a/src/Options/index.js
+++ b/src/Options/index.js
@@ -624,6 +624,12 @@ export interface DatabaseOptions {
minPoolSize: ?number;
/* The MongoDB driver option to set the maximum number of opened, cached, ready-to-use database connections maintained by the driver. */
maxPoolSize: ?number;
+ /* The MongoDB driver option to specify the amount of time in milliseconds for a server to be considered suitable for selection. */
+ serverSelectionTimeoutMS: ?number;
+ /* The MongoDB driver option to specify the amount of time in milliseconds that a connection can remain idle in the connection pool before being removed and closed. */
+ maxIdleTimeMS: ?number;
+ /* The MongoDB driver option to specify the frequency in milliseconds at which the driver checks the state of the MongoDB deployment. */
+ heartbeatFrequencyMS: ?number;
/* The MongoDB driver option to specify the amount of time, in milliseconds, to wait to establish a single TCP socket connection to the server before raising an error. Specifying 0 disables the connection timeout. */
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. */
diff --git a/types/Options/index.d.ts b/types/Options/index.d.ts
index 13fc1bd95d..ee2e6afbe6 100644
--- a/types/Options/index.d.ts
+++ b/types/Options/index.d.ts
@@ -234,6 +234,9 @@ export interface DatabaseOptions {
maxStalenessSeconds?: number;
minPoolSize?: number;
maxPoolSize?: number;
+ serverSelectionTimeoutMS?: number;
+ maxIdleTimeMS?: number;
+ heartbeatFrequencyMS?: number;
connectTimeoutMS?: number;
socketTimeoutMS?: number;
autoSelectFamily?: boolean;