Skip to content

Conversation

mauriciomoccelin
Copy link

Description

This PR introduces a new configuration parameter that allows developers to explicitly skip automatic MongoDB index creation in KafkaFlow.Retry.MongoDb.

By setting this option, the library will create collections but will not enforce index creation. This provides greater flexibility in environments where indexes are managed externally (e.g., via migrations, DevOps pipelines, or centralized governance).

Fixes #161

Motivation and Context

Currently, indexes are automatically created through DboConfigurations.TryAddIndexes. While convenient in development, this behavior may conflict with existing database policies in production environments.

The new parameter makes index management explicit, giving developers control and avoiding duplicate or conflicting index definitions.

How Has This Been Tested?

  • Unit tests were added to validate that:

    • Indexes are created when the parameter is not set (default behavior).
    • Index creation is skipped when the parameter is enabled.
  • Integration tests confirm that collections are still created and functional even when index creation is disabled.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have made corresponding changes to the documentation

Disclaimer

By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our [Contributor Ownership Statement](https://github.com/Farfetch/.github/blob/master/COS.md)

@mauriciomoccelin mauriciomoccelin force-pushed the feat/mongo-db-retry-skip-index-creation branch from b140043 to ebb754d Compare August 21, 2025 21:49
When this parameter is included, the application will ignore the creation of its indexes. This makes the behavior explicit for the developer using the library.
@mauriciomoccelin mauriciomoccelin force-pushed the feat/mongo-db-retry-skip-index-creation branch from e6221e9 to c1d2463 Compare August 22, 2025 11:57
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.

[Feature Request]: Add option to skip automatic MongoDB index creation in KafkaFlow.Retry.MongoDb
4 participants