Repository navigation
[feature][plugin][mongodbreader] Support Nested Field Extraction via Dot Notation - #1360
Merged
Merged
Conversation
…ongoDBReader Plugin via Dot Notation - Enhanced MongoRowConverter to support extracting nested fields from BSON documents using dot notation in the column configuration (e.g., "col1.subcol2", "col1.subcol3.subsubcol4"). - Added getNestedValue method to recursively resolve nested field paths. - Updated processOne to use getNestedValue for all column extraction, ensuring compatibility with both flat and nested fields. - Improved code comments for clarity and consistency in English. - This change allows users to flexibly specify and extract deeply nested MongoDB fields in their job configuration.
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.
Motivation:
Currently, the MongoDBReader plugin only supports extracting top-level fields from MongoDB documents. However, many MongoDB schemas use nested objects, and users often need to extract specific values from these nested structures. Supporting dot notation (e.g., pdf.fit, pdf.seal_file.reveal) in the column configuration will greatly improve the plugin's flexibility and usability for real-world data scenarios.
Implementation:
getNestedValuetoMongoRowConverterthat recursively resolves nested field paths using dot notation.processOnemethod to utilizegetNestedValuefor all column extractions, enabling support for both flat and deeply nested fields.Result:
Test Output: