From acedaf2bcc8262f4e12b3b8acfda70cd791227cf Mon Sep 17 00:00:00 2001
From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com>
Date: Fri, 7 Nov 2025 21:11:14 +0100
Subject: [PATCH 1/4] moe
---
src/Options/Definitions.js | 169 +++++++++++++++++++++++++++++++++++++
src/Options/docs.js | 32 +++++++
src/Options/index.js | 64 ++++++++++++++
types/Options/index.d.ts | 51 +++++++++--
4 files changed, 308 insertions(+), 8 deletions(-)
diff --git a/src/Options/Definitions.js b/src/Options/Definitions.js
index 74fc31a9bc..96d1b9b32b 100644
--- a/src/Options/Definitions.js
+++ b/src/Options/Definitions.js
@@ -1084,6 +1084,27 @@ module.exports.FileUploadOptions = {
},
};
module.exports.DatabaseOptions = {
+ appName: {
+ env: 'PARSE_SERVER_DATABASE_APP_NAME',
+ help:
+ 'The MongoDB driver option to specify the name of the application that created this MongoClient instance.',
+ },
+ authMechanism: {
+ env: 'PARSE_SERVER_DATABASE_AUTH_MECHANISM',
+ help:
+ 'The MongoDB driver option to specify the authentication mechanism that MongoDB will use to authenticate the connection.',
+ },
+ authMechanismProperties: {
+ env: 'PARSE_SERVER_DATABASE_AUTH_MECHANISM_PROPERTIES',
+ help:
+ 'The MongoDB driver option to specify properties for the specified authMechanism as a comma-separated list of colon-separated key-value pairs.',
+ action: parsers.objectParser,
+ },
+ authSource: {
+ env: 'PARSE_SERVER_DATABASE_AUTH_SOURCE',
+ help:
+ "The MongoDB driver option to specify the database name associated with the user's credentials.",
+ },
autoSelectFamily: {
env: 'PARSE_SERVER_DATABASE_AUTO_SELECT_FAMILY',
help:
@@ -1096,6 +1117,11 @@ module.exports.DatabaseOptions = {
'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'),
},
+ compressors: {
+ env: 'PARSE_SERVER_DATABASE_COMPRESSORS',
+ help:
+ 'The MongoDB driver option to specify an array or comma-delimited string of compressors to enable network compression for communication between this client and a mongod/mongos instance.',
+ },
connectTimeoutMS: {
env: 'PARSE_SERVER_DATABASE_CONNECT_TIMEOUT_MS',
help:
@@ -1151,6 +1177,12 @@ module.exports.DatabaseOptions = {
action: parsers.booleanParser,
default: true,
},
+ directConnection: {
+ env: 'PARSE_SERVER_DATABASE_DIRECT_CONNECTION',
+ help:
+ 'The MongoDB driver option to force a Single topology type with a connection string containing one host.',
+ action: parsers.booleanParser,
+ },
disableIndexFieldValidation: {
env: 'PARSE_SERVER_DATABASE_DISABLE_INDEX_FIELD_VALIDATION',
help:
@@ -1164,12 +1196,35 @@ module.exports.DatabaseOptions = {
action: parsers.booleanParser,
default: false,
},
+ forceServerObjectId: {
+ env: 'PARSE_SERVER_DATABASE_FORCE_SERVER_OBJECT_ID',
+ help: 'The MongoDB driver option to force server to assign _id values instead of driver.',
+ action: parsers.booleanParser,
+ },
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'),
},
+ loadBalanced: {
+ env: 'PARSE_SERVER_DATABASE_LOAD_BALANCED',
+ help:
+ 'The MongoDB driver option to instruct the driver it is connecting to a load balancer fronting a mongos like service.',
+ action: parsers.booleanParser,
+ },
+ localThresholdMS: {
+ env: 'PARSE_SERVER_DATABASE_LOCAL_THRESHOLD_MS',
+ help:
+ 'The MongoDB driver option to specify the size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.',
+ action: parsers.numberParser('localThresholdMS'),
+ },
+ maxConnecting: {
+ env: 'PARSE_SERVER_DATABASE_MAX_CONNECTING',
+ help:
+ 'The MongoDB driver option to specify the maximum number of connections that may be in the process of being established concurrently by the connection pool.',
+ action: parsers.numberParser('maxConnecting'),
+ },
maxIdleTimeMS: {
env: 'PARSE_SERVER_DATABASE_MAX_IDLE_TIME_MS',
help:
@@ -1200,6 +1255,51 @@ module.exports.DatabaseOptions = {
'The MongoDB driver option to set the minimum number of opened, cached, ready-to-use database connections maintained by the driver.',
action: parsers.numberParser('minPoolSize'),
},
+ proxyHost: {
+ env: 'PARSE_SERVER_DATABASE_PROXY_HOST',
+ help:
+ 'The MongoDB driver option to configure a Socks5 proxy host used for creating TCP connections.',
+ },
+ proxyPassword: {
+ env: 'PARSE_SERVER_DATABASE_PROXY_PASSWORD',
+ help:
+ 'The MongoDB driver option to configure a Socks5 proxy password when the proxy requires username/password authentication.',
+ },
+ proxyPort: {
+ env: 'PARSE_SERVER_DATABASE_PROXY_PORT',
+ help:
+ 'The MongoDB driver option to configure a Socks5 proxy port used for creating TCP connections.',
+ action: parsers.numberParser('proxyPort'),
+ },
+ proxyUsername: {
+ env: 'PARSE_SERVER_DATABASE_PROXY_USERNAME',
+ help:
+ 'The MongoDB driver option to configure a Socks5 proxy username when the proxy requires username/password authentication.',
+ },
+ readConcernLevel: {
+ env: 'PARSE_SERVER_DATABASE_READ_CONCERN_LEVEL',
+ help: 'The MongoDB driver option to specify the level of isolation.',
+ },
+ readPreference: {
+ env: 'PARSE_SERVER_DATABASE_READ_PREFERENCE',
+ help: 'The MongoDB driver option to specify the read preferences for this connection.',
+ },
+ readPreferenceTags: {
+ env: 'PARSE_SERVER_DATABASE_READ_PREFERENCE_TAGS',
+ help:
+ 'The MongoDB driver option to specify the tags document as a comma-separated list of colon-separated key-value pairs.',
+ action: parsers.arrayParser,
+ },
+ replicaSet: {
+ env: 'PARSE_SERVER_DATABASE_REPLICA_SET',
+ help:
+ 'The MongoDB driver option to specify the name of the replica set, if the mongod is a member of a replica set.',
+ },
+ retryReads: {
+ env: 'PARSE_SERVER_DATABASE_RETRY_READS',
+ help: 'The MongoDB driver option to enable retryable reads.',
+ action: parsers.booleanParser,
+ },
retryWrites: {
env: 'PARSE_SERVER_DATABASE_RETRY_WRITES',
help: 'The MongoDB driver option to set whether to retry failed writes.',
@@ -1211,6 +1311,11 @@ 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'),
},
+ serverMonitoringMode: {
+ env: 'PARSE_SERVER_DATABASE_SERVER_MONITORING_MODE',
+ help:
+ 'The MongoDB driver option to instruct the driver monitors to use a specific monitoring mode.',
+ },
serverSelectionTimeoutMS: {
env: 'PARSE_SERVER_DATABASE_SERVER_SELECTION_TIMEOUT_MS',
help:
@@ -1223,6 +1328,70 @@ module.exports.DatabaseOptions = {
'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.',
action: parsers.numberParser('socketTimeoutMS'),
},
+ srvMaxHosts: {
+ env: 'PARSE_SERVER_DATABASE_SRV_MAX_HOSTS',
+ help:
+ 'The MongoDB driver option to specify the maximum number of hosts to connect to when using an srv connection string, a setting of 0 means unlimited hosts.',
+ action: parsers.numberParser('srvMaxHosts'),
+ },
+ srvServiceName: {
+ env: 'PARSE_SERVER_DATABASE_SRV_SERVICE_NAME',
+ help: 'The MongoDB driver option to modify the srv URI service name.',
+ },
+ ssl: {
+ env: 'PARSE_SERVER_DATABASE_SSL',
+ help:
+ 'The MongoDB driver option to enable or disable TLS/SSL for the connection (equivalent to tls option).',
+ action: parsers.booleanParser,
+ },
+ tls: {
+ env: 'PARSE_SERVER_DATABASE_TLS',
+ help: 'The MongoDB driver option to enable or disable TLS/SSL for the connection.',
+ action: parsers.booleanParser,
+ },
+ tlsAllowInvalidCertificates: {
+ env: 'PARSE_SERVER_DATABASE_TLS_ALLOW_INVALID_CERTIFICATES',
+ help:
+ 'The MongoDB driver option to bypass validation of the certificates presented by the mongod/mongos instance.',
+ action: parsers.booleanParser,
+ },
+ tlsAllowInvalidHostnames: {
+ env: 'PARSE_SERVER_DATABASE_TLS_ALLOW_INVALID_HOSTNAMES',
+ help:
+ 'The MongoDB driver option to disable hostname validation of the certificate presented by the mongod/mongos instance.',
+ action: parsers.booleanParser,
+ },
+ tlsCAFile: {
+ env: 'PARSE_SERVER_DATABASE_TLS_CAFILE',
+ help:
+ 'The MongoDB driver option to specify the location of a local .pem file that contains the root certificate chain from the Certificate Authority.',
+ },
+ tlsCertificateKeyFile: {
+ env: 'PARSE_SERVER_DATABASE_TLS_CERTIFICATE_KEY_FILE',
+ help:
+ "The MongoDB driver option to specify the location of a local .pem file that contains the client's TLS/SSL certificate and key.",
+ },
+ tlsCertificateKeyFilePassword: {
+ env: 'PARSE_SERVER_DATABASE_TLS_CERTIFICATE_KEY_FILE_PASSWORD',
+ help: 'The MongoDB driver option to specify the password to decrypt the tlsCertificateKeyFile.',
+ },
+ tlsInsecure: {
+ env: 'PARSE_SERVER_DATABASE_TLS_INSECURE',
+ help: 'The MongoDB driver option to disable various certificate validations.',
+ action: parsers.booleanParser,
+ },
+ waitQueueTimeoutMS: {
+ env: 'PARSE_SERVER_DATABASE_WAIT_QUEUE_TIMEOUT_MS',
+ help:
+ 'The MongoDB driver option to specify the maximum time in milliseconds that a thread can wait for a connection to become available.',
+ action: parsers.numberParser('waitQueueTimeoutMS'),
+ },
+ zlibCompressionLevel: {
+ env: 'PARSE_SERVER_DATABASE_ZLIB_COMPRESSION_LEVEL',
+ help:
+ 'The MongoDB driver option to specify the compression level if using zlib for network compression (0-9).',
+ action: parsers.numberParser('zlibCompressionLevel'),
+ },
};
module.exports.AuthAdapter = {
enabled: {
diff --git a/src/Options/docs.js b/src/Options/docs.js
index 00b9634bb0..ade153cdb3 100644
--- a/src/Options/docs.js
+++ b/src/Options/docs.js
@@ -240,8 +240,13 @@
/**
* @interface DatabaseOptions
+ * @property {String} appName The MongoDB driver option to specify the name of the application that created this MongoClient instance.
+ * @property {String} authMechanism The MongoDB driver option to specify the authentication mechanism that MongoDB will use to authenticate the connection.
+ * @property {Any} authMechanismProperties The MongoDB driver option to specify properties for the specified authMechanism as a comma-separated list of colon-separated key-value pairs.
+ * @property {String} authSource The MongoDB driver option to specify the database name associated with the user's credentials.
* @property {Boolean} autoSelectFamily 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.
* @property {Number} autoSelectFamilyAttemptTimeout 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.
+ * @property {Union} compressors The MongoDB driver option to specify an array or comma-delimited string of compressors to enable network compression for communication between this client and a mongod/mongos instance.
* @property {Number} connectTimeoutMS 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.
* @property {Boolean} createIndexRoleName Set to `true` to automatically create a unique index on the name field of the _Role 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} createIndexUserEmail Set to `true` to automatically create indexes on the email 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.
@@ -250,18 +255,45 @@
* @property {Boolean} createIndexUserPasswordResetToken Set to `true` to automatically create an index on the _perishable_token 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} createIndexUserUsername Set to `true` to automatically create indexes 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} 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} directConnection The MongoDB driver option to force a Single topology type with a connection string containing one host.
* @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 {Boolean} forceServerObjectId The MongoDB driver option to force server to assign _id values instead of driver.
* @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 {Boolean} loadBalanced The MongoDB driver option to instruct the driver it is connecting to a load balancer fronting a mongos like service.
+ * @property {Number} localThresholdMS The MongoDB driver option to specify the size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.
+ * @property {Number} maxConnecting The MongoDB driver option to specify the maximum number of connections that may be in the process of being established concurrently by the connection pool.
* @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 {String} proxyHost The MongoDB driver option to configure a Socks5 proxy host used for creating TCP connections.
+ * @property {String} proxyPassword The MongoDB driver option to configure a Socks5 proxy password when the proxy requires username/password authentication.
+ * @property {Number} proxyPort The MongoDB driver option to configure a Socks5 proxy port used for creating TCP connections.
+ * @property {String} proxyUsername The MongoDB driver option to configure a Socks5 proxy username when the proxy requires username/password authentication.
+ * @property {String} readConcernLevel The MongoDB driver option to specify the level of isolation.
+ * @property {String} readPreference The MongoDB driver option to specify the read preferences for this connection.
+ * @property {Any[]} readPreferenceTags The MongoDB driver option to specify the tags document as a comma-separated list of colon-separated key-value pairs.
+ * @property {String} replicaSet The MongoDB driver option to specify the name of the replica set, if the mongod is a member of a replica set.
+ * @property {Boolean} retryReads The MongoDB driver option to enable retryable reads.
* @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 {String} serverMonitoringMode The MongoDB driver option to instruct the driver monitors to use a specific monitoring mode.
* @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.
+ * @property {Number} srvMaxHosts The MongoDB driver option to specify the maximum number of hosts to connect to when using an srv connection string, a setting of 0 means unlimited hosts.
+ * @property {String} srvServiceName The MongoDB driver option to modify the srv URI service name.
+ * @property {Boolean} ssl The MongoDB driver option to enable or disable TLS/SSL for the connection (equivalent to tls option).
+ * @property {Boolean} tls The MongoDB driver option to enable or disable TLS/SSL for the connection.
+ * @property {Boolean} tlsAllowInvalidCertificates The MongoDB driver option to bypass validation of the certificates presented by the mongod/mongos instance.
+ * @property {Boolean} tlsAllowInvalidHostnames The MongoDB driver option to disable hostname validation of the certificate presented by the mongod/mongos instance.
+ * @property {String} tlsCAFile The MongoDB driver option to specify the location of a local .pem file that contains the root certificate chain from the Certificate Authority.
+ * @property {String} tlsCertificateKeyFile The MongoDB driver option to specify the location of a local .pem file that contains the client's TLS/SSL certificate and key.
+ * @property {String} tlsCertificateKeyFilePassword The MongoDB driver option to specify the password to decrypt the tlsCertificateKeyFile.
+ * @property {Boolean} tlsInsecure The MongoDB driver option to disable various certificate validations.
+ * @property {Number} waitQueueTimeoutMS The MongoDB driver option to specify the maximum time in milliseconds that a thread can wait for a connection to become available.
+ * @property {Number} zlibCompressionLevel The MongoDB driver option to specify the compression level if using zlib for network compression (0-9).
*/
/**
diff --git a/src/Options/index.js b/src/Options/index.js
index 11908ae1cc..35b5821987 100644
--- a/src/Options/index.js
+++ b/src/Options/index.js
@@ -638,6 +638,70 @@ export interface DatabaseOptions {
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;
+ /* The MongoDB driver option to specify the maximum number of connections that may be in the process of being established concurrently by the connection pool. */
+ maxConnecting: ?number;
+ /* The MongoDB driver option to specify the maximum time in milliseconds that a thread can wait for a connection to become available. */
+ waitQueueTimeoutMS: ?number;
+ /* The MongoDB driver option to specify the name of the replica set, if the mongod is a member of a replica set. */
+ replicaSet: ?string;
+ /* The MongoDB driver option to force a Single topology type with a connection string containing one host. */
+ directConnection: ?boolean;
+ /* The MongoDB driver option to instruct the driver it is connecting to a load balancer fronting a mongos like service. */
+ loadBalanced: ?boolean;
+ /* The MongoDB driver option to specify the size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances. */
+ localThresholdMS: ?number;
+ /* The MongoDB driver option to specify the maximum number of hosts to connect to when using an srv connection string, a setting of 0 means unlimited hosts. */
+ srvMaxHosts: ?number;
+ /* The MongoDB driver option to modify the srv URI service name. */
+ srvServiceName: ?string;
+ /* The MongoDB driver option to enable or disable TLS/SSL for the connection. */
+ tls: ?boolean;
+ /* The MongoDB driver option to enable or disable TLS/SSL for the connection (equivalent to tls option). */
+ ssl: ?boolean;
+ /* The MongoDB driver option to specify the location of a local .pem file that contains the client's TLS/SSL certificate and key. */
+ tlsCertificateKeyFile: ?string;
+ /* The MongoDB driver option to specify the password to decrypt the tlsCertificateKeyFile. */
+ tlsCertificateKeyFilePassword: ?string;
+ /* The MongoDB driver option to specify the location of a local .pem file that contains the root certificate chain from the Certificate Authority. */
+ tlsCAFile: ?string;
+ /* The MongoDB driver option to bypass validation of the certificates presented by the mongod/mongos instance. */
+ tlsAllowInvalidCertificates: ?boolean;
+ /* The MongoDB driver option to disable hostname validation of the certificate presented by the mongod/mongos instance. */
+ tlsAllowInvalidHostnames: ?boolean;
+ /* The MongoDB driver option to disable various certificate validations. */
+ tlsInsecure: ?boolean;
+ /* The MongoDB driver option to specify an array or comma-delimited string of compressors to enable network compression for communication between this client and a mongod/mongos instance. */
+ compressors: ?(string[] | string);
+ /* The MongoDB driver option to specify the compression level if using zlib for network compression (0-9). */
+ zlibCompressionLevel: ?number;
+ /* The MongoDB driver option to specify the read preferences for this connection. */
+ readPreference: ?string;
+ /* The MongoDB driver option to specify the tags document as a comma-separated list of colon-separated key-value pairs. */
+ readPreferenceTags: ?(any[]);
+ /* The MongoDB driver option to specify the level of isolation. */
+ readConcernLevel: ?string;
+ /* The MongoDB driver option to specify the database name associated with the user's credentials. */
+ authSource: ?string;
+ /* The MongoDB driver option to specify the authentication mechanism that MongoDB will use to authenticate the connection. */
+ authMechanism: ?string;
+ /* The MongoDB driver option to specify properties for the specified authMechanism as a comma-separated list of colon-separated key-value pairs. */
+ authMechanismProperties: ?any;
+ /* The MongoDB driver option to specify the name of the application that created this MongoClient instance. */
+ appName: ?string;
+ /* The MongoDB driver option to enable retryable reads. */
+ retryReads: ?boolean;
+ /* The MongoDB driver option to force server to assign _id values instead of driver. */
+ forceServerObjectId: ?boolean;
+ /* The MongoDB driver option to instruct the driver monitors to use a specific monitoring mode. */
+ serverMonitoringMode: ?string;
+ /* The MongoDB driver option to configure a Socks5 proxy host used for creating TCP connections. */
+ proxyHost: ?string;
+ /* The MongoDB driver option to configure a Socks5 proxy port used for creating TCP connections. */
+ proxyPort: ?number;
+ /* The MongoDB driver option to configure a Socks5 proxy username when the proxy requires username/password authentication. */
+ proxyUsername: ?string;
+ /* The MongoDB driver option to configure a Socks5 proxy password when the proxy requires username/password authentication. */
+ proxyPassword: ?string;
/* Set to `true` to automatically create indexes on the email 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.
:DEFAULT: true */
createIndexUserEmail: ?boolean;
diff --git a/types/Options/index.d.ts b/types/Options/index.d.ts
index ee2e6afbe6..3cb604bbe1 100644
--- a/types/Options/index.d.ts
+++ b/types/Options/index.d.ts
@@ -227,20 +227,55 @@ export interface FileUploadOptions {
enableForPublic?: boolean;
}
export interface DatabaseOptions {
+ // Parse Server custom options
enableSchemaHooks?: boolean;
schemaCacheTtl?: number;
- retryWrites?: boolean;
- maxTimeMS?: number;
+
+ // MongoDB driver options
+ appName?: string;
+ authMechanism?: string;
+ authMechanismProperties?: any;
+ authSource?: string;
+ autoSelectFamily?: boolean;
+ autoSelectFamilyAttemptTimeout?: number;
+ compressors?: string[] | string;
+ connectTimeoutMS?: number;
+ directConnection?: boolean;
+ forceServerObjectId?: boolean;
+ heartbeatFrequencyMS?: number;
+ loadBalanced?: boolean;
+ localThresholdMS?: number;
+ maxConnecting?: number;
+ maxIdleTimeMS?: number;
+ maxPoolSize?: number;
maxStalenessSeconds?: number;
+ maxTimeMS?: number;
minPoolSize?: number;
- maxPoolSize?: number;
+ proxyHost?: string;
+ proxyPassword?: string;
+ proxyPort?: number;
+ proxyUsername?: string;
+ readConcernLevel?: string;
+ readPreference?: string;
+ readPreferenceTags?: any[];
+ replicaSet?: string;
+ retryReads?: boolean;
+ retryWrites?: boolean;
+ serverMonitoringMode?: string;
serverSelectionTimeoutMS?: number;
- maxIdleTimeMS?: number;
- heartbeatFrequencyMS?: number;
- connectTimeoutMS?: number;
socketTimeoutMS?: number;
- autoSelectFamily?: boolean;
- autoSelectFamilyAttemptTimeout?: number;
+ srvMaxHosts?: number;
+ srvServiceName?: string;
+ ssl?: boolean;
+ tls?: boolean;
+ tlsAllowInvalidCertificates?: boolean;
+ tlsAllowInvalidHostnames?: boolean;
+ tlsCAFile?: string;
+ tlsCertificateKeyFile?: string;
+ tlsCertificateKeyFilePassword?: string;
+ tlsInsecure?: boolean;
+ waitQueueTimeoutMS?: number;
+ zlibCompressionLevel?: number;
}
export interface AuthAdapter {
enabled?: boolean;
From ad0c73c76687d37ba0f0d361a15ee85b02bcfbc8 Mon Sep 17 00:00:00 2001
From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com>
Date: Fri, 7 Nov 2025 21:16:48 +0100
Subject: [PATCH 2/4] test
---
spec/ParseConfigKey.spec.js | 52 ++++++++++++++++++++++++++++++-------
1 file changed, 42 insertions(+), 10 deletions(-)
diff --git a/spec/ParseConfigKey.spec.js b/spec/ParseConfigKey.spec.js
index dcc51d5c7d..62b796bc07 100644
--- a/spec/ParseConfigKey.spec.js
+++ b/spec/ParseConfigKey.spec.js
@@ -67,25 +67,57 @@ describe('Config Keys', () => {
expect(loggerErrorSpy.calls.all().reduce((s, call) => s += call.args[0], '')).not.toMatch(invalidKeyErrorMessage);
});
- it_only_db('mongo')('recognizes valid keys in databaseOptions (MongoDB)', async () => {
+ fit_only_db('mongo')('recognizes valid keys in databaseOptions (MongoDB)', async () => {
await expectAsync(reconfigureServer({
databaseURI: 'mongodb://localhost:27017/parse',
filesAdapter: null,
databaseAdapter: null,
databaseOptions: {
- retryWrites: true,
- maxTimeMS: 1000,
- maxStalenessSeconds: 10,
+ appName: 'MyParseApp',
+ authMechanism: 'SCRAM-SHA-256',
+ authMechanismProperties: { SERVICE_NAME: 'mongodb' },
+ authSource: 'admin',
+ autoSelectFamily: true,
+ autoSelectFamilyAttemptTimeout: 3000,
+ compressors: ['snappy', 'zlib'],
+ connectTimeoutMS: 5000,
+ directConnection: false,
+ disableIndexFieldValidation: true,
+ forceServerObjectId: false,
+ heartbeatFrequencyMS: 10000,
+ loadBalanced: false,
+ localThresholdMS: 15,
+ maxConnecting: 2,
+ maxIdleTimeMS: 60000,
maxPoolSize: 10,
+ maxStalenessSeconds: 10,
+ maxTimeMS: 1000,
minPoolSize: 5,
+ proxyHost: 'proxy.example.com',
+ proxyPassword: 'proxypass',
+ proxyPort: 1080,
+ proxyUsername: 'proxyuser',
+ readConcernLevel: 'majority',
+ readPreference: 'secondaryPreferred',
+ readPreferenceTags: [{ dc: 'east' }],
+ replicaSet: 'myReplicaSet',
+ retryReads: true,
+ retryWrites: true,
+ serverMonitoringMode: 'auto',
serverSelectionTimeoutMS: 5000,
- maxIdleTimeMS: 60000,
- heartbeatFrequencyMS: 10000,
- connectTimeoutMS: 5000,
socketTimeoutMS: 5000,
- autoSelectFamily: true,
- autoSelectFamilyAttemptTimeout: 3000,
- disableIndexFieldValidation: true
+ srvMaxHosts: 0,
+ srvServiceName: 'mongodb',
+ ssl: false,
+ tls: true,
+ tlsAllowInvalidCertificates: false,
+ tlsAllowInvalidHostnames: false,
+ tlsCAFile: '/path/to/ca.pem',
+ tlsCertificateKeyFile: '/path/to/cert.pem',
+ tlsCertificateKeyFilePassword: 'password',
+ tlsInsecure: false,
+ waitQueueTimeoutMS: 5000,
+ zlibCompressionLevel: 6,
},
})).toBeResolved();
expect(loggerErrorSpy.calls.all().reduce((s, call) => s += call.args[0], '')).not.toMatch(invalidKeyErrorMessage);
From 5588e0bfca7d4a2d94ebd2bf6175ec1b21acdea8 Mon Sep 17 00:00:00 2001
From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com>
Date: Fri, 7 Nov 2025 21:30:37 +0100
Subject: [PATCH 3/4] test
---
spec/ParseConfigKey.spec.js | 51 +++++++++++++++++++++++++------------
1 file changed, 35 insertions(+), 16 deletions(-)
diff --git a/spec/ParseConfigKey.spec.js b/spec/ParseConfigKey.spec.js
index 62b796bc07..485aeabdca 100644
--- a/spec/ParseConfigKey.spec.js
+++ b/spec/ParseConfigKey.spec.js
@@ -74,52 +74,71 @@ describe('Config Keys', () => {
databaseAdapter: null,
databaseOptions: {
appName: 'MyParseApp',
- authMechanism: 'SCRAM-SHA-256',
- authMechanismProperties: { SERVICE_NAME: 'mongodb' },
+
+ // Cannot be tested as it requires authentication setup
+ // authMechanism: 'SCRAM-SHA-256',
+ // authMechanismProperties: { SERVICE_NAME: 'mongodb' },
+
authSource: 'admin',
autoSelectFamily: true,
autoSelectFamilyAttemptTimeout: 3000,
- compressors: ['snappy', 'zlib'],
+ compressors: ['zlib'],
connectTimeoutMS: 5000,
directConnection: false,
disableIndexFieldValidation: true,
forceServerObjectId: false,
heartbeatFrequencyMS: 10000,
- loadBalanced: false,
localThresholdMS: 15,
maxConnecting: 2,
maxIdleTimeMS: 60000,
maxPoolSize: 10,
- maxStalenessSeconds: 10,
+ maxStalenessSeconds: 90,
maxTimeMS: 1000,
minPoolSize: 5,
- proxyHost: 'proxy.example.com',
- proxyPassword: 'proxypass',
- proxyPort: 1080,
- proxyUsername: 'proxyuser',
+
+ // Cannot be tested as it requires a proxy setup
+ // proxyHost: 'proxy.example.com',
+ // proxyPassword: 'proxypass',
+ // proxyPort: 1080,
+ // proxyUsername: 'proxyuser',
+
readConcernLevel: 'majority',
readPreference: 'secondaryPreferred',
readPreferenceTags: [{ dc: 'east' }],
- replicaSet: 'myReplicaSet',
+
+ // Cannot be tested as it requires a replica set setup
+ // replicaSet: 'myReplicaSet',
+
retryReads: true,
retryWrites: true,
serverMonitoringMode: 'auto',
serverSelectionTimeoutMS: 5000,
socketTimeoutMS: 5000,
- srvMaxHosts: 0,
- srvServiceName: 'mongodb',
+
+ // Cannot be tested as it requires a replica cluster setup
+ // srvMaxHosts: 0,
+ // srvServiceName: 'mongodb',
+
ssl: false,
- tls: true,
+ tls: false,
tlsAllowInvalidCertificates: false,
tlsAllowInvalidHostnames: false,
- tlsCAFile: '/path/to/ca.pem',
- tlsCertificateKeyFile: '/path/to/cert.pem',
+ tlsCAFile: __dirname + '/support/cert/cert.pem',
+ tlsCertificateKeyFile: __dirname + '/support/cert/cert.pem',
tlsCertificateKeyFilePassword: 'password',
- tlsInsecure: false,
waitQueueTimeoutMS: 5000,
zlibCompressionLevel: 6,
},
})).toBeResolved();
+ await expectAsync(reconfigureServer({
+ databaseURI: 'mongodb://localhost:27017/parse',
+ filesAdapter: null,
+ databaseAdapter: null,
+ databaseOptions: {
+ // The following option needs to be tested separately due to driver config rules
+ tlsInsecure: false,
+ },
+ })).toBeResolved();
expect(loggerErrorSpy.calls.all().reduce((s, call) => s += call.args[0], '')).not.toMatch(invalidKeyErrorMessage);
});
});
From 047e1390399676d6acef74edb9a3dcd255f3fb48 Mon Sep 17 00:00:00 2001
From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com>
Date: Fri, 7 Nov 2025 21:31:42 +0100
Subject: [PATCH 4/4] unfit
---
spec/ParseConfigKey.spec.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spec/ParseConfigKey.spec.js b/spec/ParseConfigKey.spec.js
index 485aeabdca..2b6881e775 100644
--- a/spec/ParseConfigKey.spec.js
+++ b/spec/ParseConfigKey.spec.js
@@ -67,7 +67,7 @@ describe('Config Keys', () => {
expect(loggerErrorSpy.calls.all().reduce((s, call) => s += call.args[0], '')).not.toMatch(invalidKeyErrorMessage);
});
- fit_only_db('mongo')('recognizes valid keys in databaseOptions (MongoDB)', async () => {
+ it_only_db('mongo')('recognizes valid keys in databaseOptions (MongoDB)', async () => {
await expectAsync(reconfigureServer({
databaseURI: 'mongodb://localhost:27017/parse',
filesAdapter: null,