Skip to content

Commit 1815b01

Browse files
authored
fix: Warning logged when setting option databaseOptions.disableIndexFieldValidation (#9880)
1 parent 3f0ec42 commit 1815b01

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

spec/ParseConfigKey.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ describe('Config Keys', () => {
8181
connectTimeoutMS: 5000,
8282
socketTimeoutMS: 5000,
8383
autoSelectFamily: true,
84-
autoSelectFamilyAttemptTimeout: 3000
84+
autoSelectFamilyAttemptTimeout: 3000,
85+
disableIndexFieldValidation: true
8586
},
8687
})).toBeResolved();
8788
expect(loggerErrorSpy.calls.all().reduce((s, call) => s += call.args[0], '')).not.toMatch(invalidKeyErrorMessage);

src/Options/Definitions.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,12 @@ module.exports.DatabaseOptions = {
10921092
'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.',
10931093
action: parsers.numberParser('connectTimeoutMS'),
10941094
},
1095+
disableIndexFieldValidation: {
1096+
env: 'PARSE_SERVER_DATABASE_DISABLE_INDEX_FIELD_VALIDATION',
1097+
help:
1098+
'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.',
1099+
action: parsers.booleanParser,
1100+
},
10951101
enableSchemaHooks: {
10961102
env: 'PARSE_SERVER_DATABASE_ENABLE_SCHEMA_HOOKS',
10971103
help:

src/Options/docs.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Options/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export interface ParseServerOptions {
343343
:DEFAULT: [] */
344344
rateLimit: ?(RateLimitOptions[]);
345345
/* Options to customize the request context using inversion of control/dependency injection.*/
346-
requestContextMiddleware: ?((req: any, res: any, next: any) => void);
346+
requestContextMiddleware: ?(req: any, res: any, next: any) => void;
347347
}
348348

349349
export interface RateLimitOptions {
@@ -629,6 +629,8 @@ export interface DatabaseOptions {
629629
autoSelectFamily: ?boolean;
630630
/* 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. */
631631
autoSelectFamilyAttemptTimeout: ?number;
632+
/* 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. */
633+
disableIndexFieldValidation: ?boolean;
632634
}
633635

634636
export interface AuthAdapter {

0 commit comments

Comments
 (0)