From 051dfa88eed53868962b203acb28eca920006c03 Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Fri, 7 Nov 2025 19:46:51 +0100 Subject: [PATCH 1/2] add --- src/Options/Definitions.js | 18 ++++++++++++++++++ src/Options/docs.js | 3 +++ src/Options/index.js | 6 ++++++ types/Options/index.d.ts | 3 +++ 4 files changed, 30 insertions(+) diff --git a/src/Options/Definitions.js b/src/Options/Definitions.js index d5674eaf29..65d357473e 100644 --- a/src/Options/Definitions.js +++ b/src/Options/Definitions.js @@ -1163,6 +1163,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: @@ -1198,6 +1210,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 4d268847b1..7b31124a33 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 d5317646ba..c5f8a8e562 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 7a572a2f10..852e917f58 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; From aa7e0762c7aaae3933cfc58fe15d628e8152ec24 Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Fri, 7 Nov 2025 19:48:19 +0100 Subject: [PATCH 2/2] Update ParseConfigKey.spec.js --- spec/ParseConfigKey.spec.js | 3 +++ 1 file changed, 3 insertions(+) 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,