Skip to content

Conversation

@renczesstefan
Copy link
Member

@renczesstefan renczesstefan commented Jul 25, 2025

Description

Implements NAE-2153

Dependencies

Third party dependencies

Dependency

<dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
       <version>3.17.0</version>
</dependency>

was moved from application-engine module to nae-spring-core-adapter module.

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

This was tested manually and with unit tests.

Test Configuration

Name Tested on
OS macOS Sequoia 15.3.1
Runtime Java 21
Dependency Manager Maven 3.9.9n
Framework version Spring Boot 3.2.5
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @machacjozef
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

Summary by CodeRabbit

  • New Features

    • Added a new annotation to mark domain fields for MongoDB indexing.
    • Enabled automatic creation and configuration of MongoDB indexes during realm creation.
    • Marked key domain classes as MongoDB documents for improved data mapping.
    • Introduced a centralized and configurable component for MongoDB index management.
  • Improvements

    • Enhanced domain classes with indexing annotations to optimize database queries.
    • Simplified and centralized MongoDB index resolution and management.
    • Refined index creation process by delegating to a dedicated index configurator component.
    • Improved error handling during collection creation and index setup.
  • Dependency Updates

    • Updated project dependencies to support enhanced MongoDB index configuration.

Introduced the `@Indexed` annotation for marking fields as indexed. Enhanced the MongoDB runner to process both annotated and YAML-configured index definitions. Updated domain objects and configuration files to support index management.
Refactor MongoDB index management into a centralized configurator for better maintainability. Added @indexed annotation to various fields for automatic index resolution. Adjusted configurations and dependencies to support the new setup, consolidating indexing logic across the application.
Marking the CollectionNameProvider bean injection as @lazy prevents early initialization, potentially avoiding circular dependency issues. This ensures the application context loads more efficiently and resolves dependencies dynamically when needed.
@coderabbitai
Copy link

coderabbitai bot commented Jul 25, 2025

Warning

Rate limit exceeded

@renczesstefan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 21 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a7e3d2d and cfeb108.

📒 Files selected for processing (2)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/MongoIndexesConfigurator.java (1 hunks)
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/AbstractMongoIndexesConfigurator.java (1 hunks)

Walkthrough

This change introduces a new infrastructure for MongoDB index configuration and management. It adds a custom @Indexed annotation, updates domain models to use it, centralizes index configuration in a new MongoIndexesConfigurator component, and refactors relevant startup and service logic to use this component. Several classes are now explicitly annotated as MongoDB documents.

Changes

Cohort / File(s) Change Summary
Remove commons-lang3 from application-engine
application-engine/pom.xml
Removed org.apache.commons:commons-lang3 dependency.
Add commons-lang3 to nae-spring-core-adapter
nae-spring-core-adapter/pom.xml
Added org.apache.commons:commons-lang3 dependency.
MongoDB Index Configuration Infrastructure
application-engine/src/main/java/com/netgrif/application/engine/configuration/MongoIndexesConfigurator.java, application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/DataConfigurationProperties.java, application-engine/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/AbstractMongoIndexesConfigurator.java
Added MongoIndexesConfigurator component, new indexes property in MongoProperties, and introduced abstract base class AbstractMongoIndexesConfigurator for index resolution logic.
Refactor MongoDB Index Resolution on Startup
application-engine/src/main/java/com/netgrif/application/engine/startup/runner/MongoDbRunner.java
Replaced manual index resolution with delegation to MongoIndexesConfigurator. Removed resolveIndexes() method. Corrected logging to use properties.
Custom @indexed Annotation and Usage in Domain Models
nae-object-library/src/main/java/com/netgrif/application/engine/objects/annotations/Indexed.java, nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/domain/User.java, nae-object-library/src/main/java/com/netgrif/application/engine/objects/workflow/domain/Case.java, nae-object-library/src/main/java/com/netgrif/application/engine/objects/workflow/domain/Task.java
Introduced @Indexed annotation and applied it to relevant fields in User, Case, and Task classes.
Spring Data MongoDB Document Annotations
nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/PetriNet.java, nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/workflow/domain/Case.java, nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/workflow/domain/Task.java
Annotated PetriNet, Case, and Task classes with @Document; added indexed field test to Case.
Index Creation in Realm Service
nae-user-ce/src/main/java/com/netgrif/application/engine/auth/service/RealmServiceImpl.java
Enhanced realm creation to ensure collection and indexes are created using MongoIndexesConfigurator and CollectionNameProvider. Added setter injection for dependencies.

Sequence Diagram(s)

sequenceDiagram
    participant RealmServiceImpl
    participant CollectionNameProvider
    participant MongoTemplate
    participant MongoIndexesConfigurator

    RealmServiceImpl->>CollectionNameProvider: getCollectionName(realm)
    RealmServiceImpl->>MongoTemplate: collectionExists(collectionName)
    alt Collection does not exist
        RealmServiceImpl->>MongoTemplate: createCollection(collectionName)
        RealmServiceImpl->>MongoIndexesConfigurator: resolveIndexes(collectionName, User.class)
    end
    RealmServiceImpl-->>RealmServiceImpl: return saved realm
Loading
sequenceDiagram
    participant MongoDbRunner
    participant MongoIndexesConfigurator

    MongoDbRunner->>MongoIndexesConfigurator: resolveIndexes()
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Suggested labels

improvement

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch NAE-2153

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@renczesstefan renczesstefan requested a review from Retoocs July 25, 2025 12:36
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (4)
application-engine/src/main/java/com/netgrif/application/engine/startup/runner/MongoDbRunner.java (1)

43-44: Remove unnecessary empty lines.

Clean up the trailing empty lines for better code formatting.

-
-
application-engine/src/main/java/com/netgrif/application/engine/configuration/MongoIndexesConfigurator.java (1)

9-11: Remove unused @slf4j annotation

The @Slf4j annotation creates a logger that is not used in this class.

-@Slf4j
 @Component
 public class MongoIndexesConfigurator extends com.netgrif.application.engine.adapter.spring.configuration.MongoIndexesConfigurator {
nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/MongoIndexesConfigurator.java (2)

33-33: Add JavaDoc for abstract method

The abstract getIndexes() method should have documentation explaining its purpose and expected return value structure.

+    /**
+     * Returns a mapping of entity classes to their additional index field names.
+     * Implementations should provide indexes that are configured externally
+     * (e.g., through application properties) rather than via annotations.
+     * 
+     * @return MultiValueMap where keys are entity classes and values are field names to index
+     */
     public abstract MultiValueMap<Class<?>, String> getIndexes();

35-49: Consider caching index definitions for performance

The index resolution performs reflection operations on every call. For better performance, consider caching the resolved index definitions per entity type, especially if this method is called frequently.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bcbb9a1 and 3128e65.

📒 Files selected for processing (15)
  • application-engine/pom.xml (0 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/MongoIndexesConfigurator.java (1 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/DataConfigurationProperties.java (2 hunks)
  • application-engine/src/main/java/com/netgrif/application/engine/startup/runner/MongoDbRunner.java (3 hunks)
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/annotations/Indexed.java (1 hunks)
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/domain/User.java (2 hunks)
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/workflow/domain/Case.java (4 hunks)
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/workflow/domain/Task.java (3 hunks)
  • nae-spring-core-adapter/pom.xml (1 hunks)
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/auth/domain/User.java (1 hunks)
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/MongoIndexesConfigurator.java (1 hunks)
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/PetriNet.java (1 hunks)
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/workflow/domain/Case.java (1 hunks)
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/workflow/domain/Task.java (1 hunks)
  • nae-user-ce/src/main/java/com/netgrif/application/engine/auth/service/RealmServiceImpl.java (4 hunks)
💤 Files with no reviewable changes (1)
  • application-engine/pom.xml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: Build
  • GitHub Check: task-list-completed
🔇 Additional comments (23)
nae-object-library/src/main/java/com/netgrif/application/engine/objects/annotations/Indexed.java (1)

8-11: Well-designed marker annotation for MongoDB indexing.

The annotation follows best practices with appropriate retention policy (RUNTIME) for reflection-based processing and correct target limitation (FIELD). The simple marker design is suitable for the MongoDB indexing use case.

nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/auth/domain/User.java (2)

12-12: LGTM - Import statement correctly added.

The import for Spring Data MongoDB's @document annotation is properly placed.


16-16: LGTM - @document annotation properly applied.

The @document annotation correctly marks this User class as a MongoDB document entity, enabling it to be discovered by the new MongoIndexesConfigurator for index management.

nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/workflow/domain/Task.java (2)

19-19: LGTM - Import statement correctly added.

The import for Spring Data MongoDB's @document annotation is properly placed.


24-24: LGTM - @document annotation properly applied.

The @document annotation correctly marks this Task class as a MongoDB document entity, enabling index management through the MongoIndexesConfigurator infrastructure.

nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/workflow/domain/Case.java (1)

20-20: LGTM - @document annotation properly applied.

The @document annotation correctly marks this Case class as a MongoDB document entity.

nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/PetriNet.java (1)

11-11: LGTM! Proper MongoDB document annotation added.

The addition of the @Document annotation correctly marks this class as a MongoDB document entity, enabling it to participate in the new MongoDB indexing framework.

Also applies to: 16-16

application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/DataConfigurationProperties.java (2)

14-15: LGTM! Appropriate imports added for the new indexes property.

The imports for LinkedMultiValueMap and MultiValueMap support the new indexes configuration functionality.

Also applies to: 18-18


139-146: LGTM! Well-designed indexes property for MongoDB configuration.

The MultiValueMap<Class<?>, String> type is appropriate for storing multiple index definitions per entity class. The comprehensive Javadoc documentation clearly explains the purpose and usage of this property.

nae-object-library/src/main/java/com/netgrif/application/engine/objects/workflow/domain/Case.java (4)

4-4: LGTM! Proper import for the indexing annotation.

The import for the custom @Indexed annotation enables marking fields for MongoDB index creation.


42-43: LGTM! Appropriate indexing on petriNetObjectId field.

Indexing the petriNetObjectId field is sensible as it's frequently used to query cases by their associated Petri net process.


59-60: LGTM! Proper indexing on title field.

The title field is commonly used for searching and filtering cases, making it an appropriate candidate for indexing.


82-83: LGTM! Logical indexing on author field.

Indexing the author field enables efficient filtering of cases by their creator, which is a common query pattern.

application-engine/src/main/java/com/netgrif/application/engine/startup/runner/MongoDbRunner.java (2)

3-3: LGTM! Proper dependency injection for MongoDB index configuration.

The addition of MongoIndexesConfigurator as a dependency correctly enables delegation of index resolution to the dedicated component.

Also applies to: 27-27


38-40: LGTM! Proper delegation to the index configurator.

The refactoring correctly delegates index resolution to the MongoIndexesConfigurator, improving separation of concerns and centralizing index management logic.

nae-object-library/src/main/java/com/netgrif/application/engine/objects/workflow/domain/Task.java (5)

4-4: LGTM! Proper import for the indexing annotation.

The import for the custom @Indexed annotation enables marking fields for MongoDB index creation.


36-37: LGTM! Appropriate indexing on processId field.

The processId field is frequently used to query tasks by their associated process, making it an excellent candidate for indexing.


41-42: LGTM! Proper indexing on caseId field.

Indexing the caseId field enables efficient retrieval of tasks associated with specific cases, which is a common query pattern.


46-47: LGTM! Logical indexing on transitionId field.

The transitionId field is used to identify tasks by their workflow transition, making indexing beneficial for task filtering and retrieval.


70-71: LGTM! Essential indexing on userId field.

Indexing the userId field is crucial for efficiently querying tasks assigned to specific users, which is one of the most common task retrieval patterns.

application-engine/src/main/java/com/netgrif/application/engine/configuration/MongoIndexesConfigurator.java (1)

15-25: LGTM! Clean implementation of the configurator pattern

The class properly extends the abstract configurator and delegates index configuration to properties. The constructor correctly passes dependencies to the superclass.

nae-user-ce/src/main/java/com/netgrif/application/engine/auth/service/RealmServiceImpl.java (1)

49-53: Clarify the need for @lazy annotation

The @Lazy annotation on setCollectionNameProvider suggests a potential circular dependency. Consider documenting why lazy initialization is required here or refactoring to avoid circular dependencies.

nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/domain/User.java (1)

30-52: LGTM! Appropriate fields selected for indexing

The indexed fields (username, email, firstName, middleName, lastName) are commonly used in user queries and searches. This indexing strategy will improve query performance for typical user lookup operations.

# Conflicts:
#	nae-object-library/src/main/java/com/netgrif/application/engine/objects/auth/domain/User.java
#	nae-object-library/src/main/java/com/netgrif/application/engine/objects/workflow/domain/Case.java
#	nae-object-library/src/main/java/com/netgrif/application/engine/objects/workflow/domain/Task.java
#	nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/auth/domain/User.java
Renamed the base class to better reflect its abstract nature and purpose. Updated all references across the codebase to ensure consistency and removed an unused field from the Case class. This improves clarity and eliminates unnecessary elements.
@renczesstefan renczesstefan requested a review from Retoocs July 31, 2025 14:20
@coderabbitai coderabbitai bot added the improvement A change that improves on an existing feature label Jul 31, 2025
machacjozef and others added 2 commits August 1, 2025 02:21
Modified `resolveIndexes` to only process collections annotated with `@Document`. This ensures index definitions are applied correctly and avoids unnecessary operations on non-annotated collections. Added a safeguard using `ArrayList` to manage index definitions.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/AbstractMongoIndexesConfigurator.java (1)

57-57: Remove extra semicolon.

-        Iterable<Field> additionalIndexedProperties = FieldUtils.getFieldsListWithAnnotation(collectionType, Indexed.class);;
+        Iterable<Field> additionalIndexedProperties = FieldUtils.getFieldsListWithAnnotation(collectionType, Indexed.class);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23df28a and a5f3840.

📒 Files selected for processing (1)
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/AbstractMongoIndexesConfigurator.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: Build
🔇 Additional comments (3)
nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/AbstractMongoIndexesConfigurator.java (3)

28-32: Constructor initialization looks good.

Proper initialization of the mapping context and index resolver from the MongoTemplate.


36-41: Efficient processing of all document entities.

Good use of streams and proper filtering for @document annotated entities.


69-75: Clean implementation of configured field indexing.

Good use of MultiValueMap and proper null-safety check.

Replaced the use of `collectionName` with `collectionType` to fetch the `@Document` annotation. This ensures that index definitions are properly resolved for the correct collection type.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/AbstractMongoIndexesConfigurator.java (1)

57-57: Remove the extra semicolon.

There's an unnecessary extra semicolon at the end of the line.

-        Iterable<Field> additionalIndexedProperties = FieldUtils.getFieldsListWithAnnotation(collectionType, Indexed.class);;
+        Iterable<Field> additionalIndexedProperties = FieldUtils.getFieldsListWithAnnotation(collectionType, Indexed.class);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5f3840 and 01d0357.

📒 Files selected for processing (1)
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/AbstractMongoIndexesConfigurator.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Test
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
🔇 Additional comments (6)
nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/configuration/AbstractMongoIndexesConfigurator.java (6)

1-20: LGTM!

The package declaration and imports are well-organized and appropriate for the MongoDB index configuration functionality.


21-32: LGTM!

Clean design with proper dependency injection and immutable fields. The constructor correctly initializes the mapping context and index resolver from the MongoTemplate.


34-34: LGTM!

Good abstraction design using MultiValueMap to allow multiple index field names per entity class.


36-41: LGTM!

Properly filters MongoDB document entities and delegates to the specific index resolution method. Stream usage is appropriate and efficient.


43-54: LGTM!

The method correctly combines index definitions from all three sources (Spring Data annotations, custom @indexed annotations, and configuration). The critical annotation lookup issue identified in the previous review has been properly fixed.


56-76: LGTM!

Both helper methods correctly handle their respective index sources. The code properly respects Spring Data's @field annotation for custom field names and maintains a consistent index creation pattern.

Unused imports were cleaned up to maintain code clarity and readability. The log message was corrected to reference `mongoProperties.getDatabase()` instead of an undefined `name`, ensuring accurate database information is logged.
Enclose collection creation in a try-catch block to handle potential errors. Log the error, clean up by deleting the realm, and rethrow a runtime exception. This ensures better error handling and prevents inconsistent state.
Introduced a new method `getEntityIndexBlacklist` to allow specifying entities to exclude from index creation. Updated the `resolveIndexes` method to respect the blacklist when determining which entities to process.
@renczesstefan renczesstefan merged commit 397d743 into release/7.0.0-rev5 Aug 1, 2025
6 of 7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 20, 2025
18 tasks
@coderabbitai coderabbitai bot mentioned this pull request Jan 14, 2026
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement A change that improves on an existing feature Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants