Skip to content

maretha-io/mongo-export-json-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MongoExport JSON Processor

A Python script to stream-process large MongoDB JSON exports, replacing "af:" and "af_" prefixes with "true:" and "true_".


πŸš€ Features

βœ… Handles large JSON files using streaming (low memory usage).
βœ… Efficient field renaming (af: β†’ true:).
βœ… Fast processing using ujson and ijson.
βœ… Batch writing to optimize disk I/O.
βœ… Automated unit tests with real files.


πŸ“Œ Installation

pip install -r requirements.txt

Usage

python src/json_processor.py tests/data/test_input.ndjson tests/output/test_output.ndjson --policy-parent POLICY_PARENT_ID --policy-ancestors anc1,anc2 --billing-parent BILLING_PARENT_ID --billing-ancestors anc3,anc4 --payments-parent PAYMENTS_PARENT_ID --payments-ancestors anc5,anc6

Usage multi-line

python src/json_processor.py tests/data/test_input.ndjson tests/output/test_output.ndjson \
    --policy-parent POLICY_PARENT_ID --policy-ancestors anc1,anc2 \
    --billing-parent BILLING_PARENT_ID --billing-ancestors anc3,anc4 \
    --payments-parent PAYMENTS_PARENT_ID --payments-ancestors anc5,anc6

Testing

python -m unittest discover tests

About

A Python script to stream-process large MongoDB JSON exports and replace fields

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages