Context:
I am working with the repository, a Kotlin-based blackbox data masking tool. I need to extend its functionality to support MongoDB as both a source and a destination.
Objective:
Add the ability to read documents from a MongoDB collection, apply masking rules to specific attributes, and write the results (both masked and unmasked "as-is" data) back to a target MongoDB collection or another supported sink.
Requirements:
Analyze Existing Interfaces: First, examine the codebase to identify the core interfaces for data handling (e.g., DataSource, DataSink, MaskingProvider, or Configuration). Ensure the new MongoDB implementation adheres to these abstractions.
MongoDB Connector:
Implement a MongoSource that can connect to a database and stream documents from a specified collection.
Implement a MongoSink that can write or upsert documents into a target collection.
Use the official mongodb-driver-kotlin-coroutine or a similar idiomatic Kotlin driver.
Selective Attribute Masking:
The implementation must allow users to define which JSON/BSON attributes to mask via a configuration file (YAML or JSON).
"As-Is" Transfer: Any attribute not explicitly targeted for masking should be transferred to the destination exactly as it appeared in the source.
Configuration Schema: Propose an update to the configuration logic to support MongoDB connection strings and attribute mapping. Example structure:
Maintain Blackbox Nature: Ensure the masking logic remains "blackbox"—it should handle nested documents and arrays without requiring a rigid pre-defined schema for every collection.
Extend the existing UI for data selection/masking
Deliverables:
A list of new/modified files.
The Kotlin implementation for the MongoDB source and sink.
An example configuration file demonstrating selective masking and "as-is" transfer.
Context:
I am working with the repository, a Kotlin-based blackbox data masking tool. I need to extend its functionality to support MongoDB as both a source and a destination.
Objective:
Add the ability to read documents from a MongoDB collection, apply masking rules to specific attributes, and write the results (both masked and unmasked "as-is" data) back to a target MongoDB collection or another supported sink.
Requirements:
Analyze Existing Interfaces: First, examine the codebase to identify the core interfaces for data handling (e.g., DataSource, DataSink, MaskingProvider, or Configuration). Ensure the new MongoDB implementation adheres to these abstractions.
MongoDB Connector:
Implement a MongoSource that can connect to a database and stream documents from a specified collection.
Implement a MongoSink that can write or upsert documents into a target collection.
Use the official mongodb-driver-kotlin-coroutine or a similar idiomatic Kotlin driver.
Selective Attribute Masking:
The implementation must allow users to define which JSON/BSON attributes to mask via a configuration file (YAML or JSON).
"As-Is" Transfer: Any attribute not explicitly targeted for masking should be transferred to the destination exactly as it appeared in the source.
Configuration Schema: Propose an update to the configuration logic to support MongoDB connection strings and attribute mapping. Example structure:
Maintain Blackbox Nature: Ensure the masking logic remains "blackbox"—it should handle nested documents and arrays without requiring a rigid pre-defined schema for every collection.
Extend the existing UI for data selection/masking
Deliverables:
A list of new/modified files.
The Kotlin implementation for the MongoDB source and sink.
An example configuration file demonstrating selective masking and "as-is" transfer.