feat: Add options to skip automatic creation of internal database indexes on server start (#9897)

This commit is contained in:
Manuel
2025-11-01 18:22:52 +01:00
committed by GitHub
parent 4f4580a083
commit ea91aca142
6 changed files with 316 additions and 34 deletions

View File

@@ -154,8 +154,22 @@ export class MongoStorageAdapter implements StorageAdapter {
this.enableSchemaHooks = !!mongoOptions.enableSchemaHooks;
this.schemaCacheTtl = mongoOptions.schemaCacheTtl;
this.disableIndexFieldValidation = !!mongoOptions.disableIndexFieldValidation;
for (const key of ['enableSchemaHooks', 'schemaCacheTtl', 'maxTimeMS', 'disableIndexFieldValidation']) {
delete mongoOptions[key];
// Remove Parse Server-specific options that should not be passed to MongoDB client
// Note: We only delete from this._mongoOptions, not from the original mongoOptions object,
// because other components (like DatabaseController) need access to these options
for (const key of [
'enableSchemaHooks',
'schemaCacheTtl',
'maxTimeMS',
'disableIndexFieldValidation',
'createIndexUserUsername',
'createIndexUserUsernameCaseInsensitive',
'createIndexUserEmail',
'createIndexUserEmailCaseInsensitive',
'createIndexUserEmailVerifyToken',
'createIndexUserPasswordResetToken',
'createIndexRoleName',
]) {
delete this._mongoOptions[key];
}
}