Do not throw error if user provide a pointer like index onMongo - #6923
Merged
davimacedo merged 2 commits intoOct 1, 2020
Merged
Conversation
Member
Author
|
Since lint here just add some difficulty to read here the main (little) code: Object.keys(field).forEach(key => {
if (
!Object.prototype.hasOwnProperty.call(
fields,
key.indexOf('_p_') === 0 ? key.replace('_p_', '') : key
)
) { |
Codecov Report
@@ Coverage Diff @@
## master #6923 +/- ##
==========================================
- Coverage 93.85% 93.80% -0.05%
==========================================
Files 169 169
Lines 12220 12220
==========================================
- Hits 11469 11463 -6
- Misses 751 757 +6
Continue to review full report at Codecov.
|
Member
Author
|
Test case added i don't know why code cov is not happy :/ |
davimacedo
approved these changes
Oct 1, 2020
nagendertank
pushed a commit
to nagendertank/parse-server
that referenced
this pull request
Aug 18, 2026
…pdatedAt`, `objectId`, `sessionToken`) declared via the schema API or schema definitions are created on the Parse field name instead of the MongoDB storage key, so queries never use them The MongoDB adapter stores Pointer fields under `_p_<field>` and several built-in fields under internal keys (`_created_at`, `_updated_at`, `_id`, `_session_token`, `_last_used`, `times_used`), and the query transform rewrites query keys accordingly. `ensureIndex` and `ensureUniqueness` already translate index keys the same way, but `setIndexesWithSchemaFormat` - the path behind the schemas REST API and schema definitions (DefinedSchemas) - created the physical index on the declared field name verbatim, producing an index that queries can never use while the schema API reported it as present. The physical index is now created on the storage key via the same `transformKey` mapping the query path uses, while `_metadata.indexes` keeps storing and reporting the declared Parse-format key spec. The startup index re-sync (`setIndexesFromMongo`) now preserves a declared key spec when it maps to the same physical index, so schema API responses stay stable across restarts and schema definitions do not detect a false difference and rebuild indexes on every boot. Existing behavior is preserved: declarations that already use storage keys (e.g. `_p_field`, supported since parse-community#6923) work unchanged, indexes created outside Parse Server are still discovered and reported with their raw keys, and pre-existing (non-functional) indexes on existing deployments are left untouched; deleting and re-adding such an index through the schema API now yields a working index. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here a mini fix since an old PR of @dplewis was closed (#4629) to just allow advanced developers to create index for pointers field. I know it's not the best solution, but currently it could be an easy workaround.