@@ -16,7 +16,7 @@ import {
1616import Parse from 'parse/node' ;
1717// @flow -disable-next
1818import _ from 'lodash' ;
19- import defaults from '../../../defaults' ;
19+ import defaults , { ParseServerDatabaseOptions } from '../../../defaults' ;
2020import logger from '../../../logger' ;
2121import Utils from '../../../Utils' ;
2222
@@ -147,7 +147,6 @@ export class MongoStorageAdapter implements StorageAdapter {
147147 constructor ( { uri = defaults . DefaultMongoURI , collectionPrefix = '' , mongoOptions = { } } : any ) {
148148 this . _uri = uri ;
149149 this . _collectionPrefix = collectionPrefix ;
150- this . _mongoOptions = { ...mongoOptions } ;
151150 this . _onchange = ( ) => { } ;
152151
153152 // MaxTimeMS is not a global MongoDB client option, it is applied per operation.
@@ -158,24 +157,12 @@ export class MongoStorageAdapter implements StorageAdapter {
158157 this . disableIndexFieldValidation = ! ! mongoOptions . disableIndexFieldValidation ;
159158 this . _logClientEvents = mongoOptions . logClientEvents ;
160159
161- // Remove Parse Server-specific options that should not be passed to MongoDB client
162- // Note: We only delete from this._mongoOptions, not from the original mongoOptions object,
163- // because other components (like DatabaseController) need access to these options
164- for ( const key of [
165- 'allowPublicExplain' ,
166- 'enableSchemaHooks' ,
167- 'schemaCacheTtl' ,
168- 'maxTimeMS' ,
169- 'disableIndexFieldValidation' ,
170- 'logClientEvents' ,
171- 'createIndexUserUsername' ,
172- 'createIndexUserUsernameCaseInsensitive' ,
173- 'createIndexUserEmail' ,
174- 'createIndexUserEmailCaseInsensitive' ,
175- 'createIndexUserEmailVerifyToken' ,
176- 'createIndexUserPasswordResetToken' ,
177- 'createIndexRoleName' ,
178- ] ) {
160+ // Create a copy of mongoOptions and remove Parse Server-specific options that should not
161+ // be passed to MongoDB client. Note: We only delete from this._mongoOptions, not from the
162+ // original mongoOptions object, because other components (like DatabaseController) need
163+ // access to these options.
164+ this . _mongoOptions = { ...mongoOptions } ;
165+ for ( const key of ParseServerDatabaseOptions ) {
179166 delete this . _mongoOptions [ key ] ;
180167 }
181168 }
0 commit comments