fix: mongo schema collections order of mongo plugin
PR Description:
-
Issue fixed: https://github.com/appsmithorg/appsmith/issues/35842
-
File changes in the PR:
- Integrated the sorting feature to the mongo collections.
- Added the unit test for sorting.
-
Snapshots:
Before resolving bug:
After resolving bug:
Summary by CodeRabbit
-
New Features
- Enhanced the MongoDB plugin to return collection names in a case-insensitive sorted order, improving predictability and user experience.
-
Tests
- Added a new test to validate that collections returned by the plugin are sorted correctly, ensuring consistent functionality.
Walkthrough
The changes involve modifications to the getStructure method in the MongoPlugin class to ensure that MongoDB collection names are returned in a case-insensitive sorted order. Additionally, a new test method has been added to verify that the collections are indeed sorted correctly, enhancing the reliability of the plugin's functionality.
Changes
| File | Change Summary |
|---|---|
| app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java | Modified getStructure method to sort collection names in a case-insensitive manner. |
| app/server/appsmith-plugins/mongoPlugin/src/test/java/com/external/plugins/MongoPluginQueriesTest.java | Added testStructure_should_return_collections_in_order to verify sorted order of collections. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant MongoPlugin
participant Database
User->>MongoPlugin: Request collection structure
MongoPlugin->>Database: Fetch collection names
Database-->>MongoPlugin: Return collection names
MongoPlugin->>MongoPlugin: Sort collection names (case-insensitive)
MongoPlugin-->>User: Return sorted collection names
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Collections are sorted in schemas (Issue #35842) | ✅ |
Poem
In the realm of Mongo, collections align,
With names now sorted, oh how they shine!
From chaos to order, a tidy display,
A plugin enhancement, brightening the day!
Let's celebrate coding, with joy in our heart,
For every small change is a beautiful art! 🎉
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>. -
Generate unit testing code for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai generate interesting stats about this repository and render them as a table. -
@coderabbitai show all the console.log statements in this repository. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Early access features: disabled
We are currently testing the following features in early access:
-
Anthropic
claude-3-5-sonnetfor code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.
Note:
- You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
- Please join our Discord Community to provide feedback and report issues on the discussion post.
Hi @NilanshBansal, @sagar-qa007, Could you please review this PR. Thank you.
This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.
Hi @NilanshBansal , Could you please review the PR if possible. It has been opened since last 3 weeks.
Hey @raushan3737 apologies for the inconvenience, we are starting to review this PR and targeting to complete it by Next Friday.
Hi @raushan3737 thanks for your patience. We have created shadow PR here to run the tests.
/build-deploy-preview skip-tests=true
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/11029317630.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 36062.
recreate: .
Deploy-Preview-URL: https://ce-36062.dp.appsmith.com
Tested the DP, it looks good to me.
@raushan3737 thanks for taking out time to contribute to Appsmith! We highly appreciate your effort in making Appsmith better ❤️ You can find more issues to contribute from this list!