You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support subkey index for Parse Schema indexes #7711
changed the title [-]Support subkey index from Parse Schema indexe (like: "anArrayField.aKeyIntoAnElement")[/-][+]Support subkey index from Parse Schema indexes (like: "anArrayField.aKeyIntoAnElement")[/+]on Nov 19, 2021
changed the title [-]Support subkey index from Parse Schema indexes (like: "anArrayField.aKeyIntoAnElement")[/-][+]Support subkey index for Parse Schema indexes[/+]on Nov 19, 2021
We need this too, together with the wildcard variant on the same kind of field, and would like to contribute it.
Use case. We run Parse Server on MongoDB with Defined Schemas (strict: true, keepUnknownIndexes not set). At each server start the migration deletes every index that is not declared in the definitions, so the indexes we need must be declared. A class stores a group of dates in an Object field date, and queries filter and sort on single keys of it per tenant:
The schema endpoint rejects both with Field date.funeral does not exist, cannot add index., because the index field validation only knows top-level fields (and the _p_ prefix). disableIndexFieldValidation accepts them, but it turns off the check for every index.
Proposal. In MongoStorageAdapter.setIndexesWithSchemaFormat, also accept as an index key:
a key of an Object or Array field in dot notation: field.key, field.key.nestedKey (this also covers the multikey example in this issue, anArrayField.aKeyIntoAnElement);
a wildcard on all the keys of such a field: field.$** (also field.key.$**).
The first segment must be a declared field of type Object or Array. The following segments must be non-empty and must not start with $, except a final $**. Everything else is still rejected with the current error. Nothing else changes: these keys are already stored in _SCHEMA and read back by updateSchemaWithIndexes as they are (_auth_data_<provider>.id works the same way). Postgres keeps rejecting them, since it would need expression indexes on jsonb.
Activity
parse-github-assistant commentedon Nov 19, 2021
Thanks for opening this issue!
[-]Support subkey index from Parse Schema indexe (like: "anArrayField.aKeyIntoAnElement")[/-][+]Support subkey index from Parse Schema indexes (like: "anArrayField.aKeyIntoAnElement")[/+][-]Support subkey index from Parse Schema indexes (like: "anArrayField.aKeyIntoAnElement")[/-][+]Support subkey index for Parse Schema indexes[/+]cerasonileonardo commentedon Nov 9, 2026
We need this too, together with the wildcard variant on the same kind of field, and would like to contribute it.
Use case. We run Parse Server on MongoDB with Defined Schemas (
strict: true,keepUnknownIndexesnot set). At each server start the migration deletes every index that is not declared in the definitions, so the indexes we need must be declared. A class stores a group of dates in anObjectfielddate, and queries filter and sort on single keys of it per tenant:The schema endpoint rejects both with
Field date.funeral does not exist, cannot add index., because the index field validation only knows top-level fields (and the_p_prefix).disableIndexFieldValidationaccepts them, but it turns off the check for every index.Proposal. In
MongoStorageAdapter.setIndexesWithSchemaFormat, also accept as an index key:ObjectorArrayfield in dot notation:field.key,field.key.nestedKey(this also covers the multikey example in this issue,anArrayField.aKeyIntoAnElement);field.$**(alsofield.key.$**).The first segment must be a declared field of type
ObjectorArray. The following segments must be non-empty and must not start with$, except a final$**. Everything else is still rejected with the current error. Nothing else changes: these keys are already stored in_SCHEMAand read back byupdateSchemaWithIndexesas they are (_auth_data_<provider>.idworks the same way). Postgres keeps rejecting them, since it would need expression indexes onjsonb.PR: #10876