Skip to content

feat: Add option keepUnknownIndexes to retain indexes which are not specified in schema (#9857)#13

Merged
hariprasadiit merged 1 commit into7-vizmofrom
7-vizmo-cherry-pick-unknown-index-changes
Oct 10, 2025
Merged

feat: Add option keepUnknownIndexes to retain indexes which are not specified in schema (#9857)#13
hariprasadiit merged 1 commit into7-vizmofrom
7-vizmo-cherry-pick-unknown-index-changes

Conversation

@RahulLanjewar93
Copy link
Copy Markdown

Pull Request

Issue

Closes: FILL_THIS_OUT

Approach

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)
  • Add security check
  • Add new Parse Error codes to Parse JS SDK

@RahulLanjewar93 RahulLanjewar93 self-assigned this Oct 9, 2025
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @RahulLanjewar93, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the configuration options available in the system by clarifying an existing schema setting and introducing a new database-level setting. The primary goal is to improve user control over database index management during schema migrations and to offer more granular control over MongoDB driver behavior when handling undefined values, ultimately leading to better maintainability and predictability.

Highlights

  • keepUnknownIndexes Option Clarification: The help text and JSDoc for the keepUnknownIndexes schema option have been updated to provide a clearer, more descriptive explanation of its purpose, optional status, and default value. This option allows users to retain database indexes not defined in the schema, preventing their removal during schema migrations.
  • ignoreUndefined Database Option: A new ignoreUndefined option has been introduced within the DatabaseOptions to configure the MongoDB driver's behavior regarding undefined values in BSON documents. Its definition and documentation have been added and positioned accordingly.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new configuration option keepUnknownIndexes. My review identifies a critical issue regarding the missing implementation for this new feature, which makes it non-functional as is. Additionally, I've provided a suggestion to improve code maintainability by sorting option properties alphabetically in the source file to keep it consistent with the auto-generated files and reduce future diff noise. Please see the detailed comments in the code.

Comment on lines +28 to 30
/* (Optional) Keep indexes that are present in the database but not defined in the schema. Set this to `true` if you are adding indexes manually, so that they won't be removed when running schema migration. Default is `false`.
:DEFAULT: false */
keepUnknownIndexes: ?boolean;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This pull request adds the configuration option keepUnknownIndexes, but the implementation that actually uses this option seems to be missing. Without the corresponding logic changes to the schema migration process, this option will have no effect. This is critical for the feature to be complete. Could you please add the implementation?

Comment on lines +1086 to +1090
ignoreUndefined: {
env: 'PARSE_SERVER_DATABASE_IGNORE_UNDEFINED',
help: 'The MongoDB driver option to set whether to ignore undefined values in BSON documents.',
action: parsers.booleanParser,
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

I see that ignoreUndefined has been moved here to maintain alphabetical order, which is great for readability. This is likely due to the build script that generates this file. To improve consistency and prevent noisy diffs in the future, it would be beneficial to also reorder the properties within the DatabaseOptions interface in src/Options/index.js to be alphabetical. This would make the source and generated files consistent.

@hariprasadiit hariprasadiit merged commit 06a651b into 7-vizmo Oct 10, 2025
7 of 26 checks passed
@hariprasadiit hariprasadiit deleted the 7-vizmo-cherry-pick-unknown-index-changes branch October 10, 2025 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants