Export data from MongoDB collections with pagination, delays, and retry logic
Project description
🍃 mongoexport
Export data from MongoDB collections with advanced features like pagination, configurable delays, and automatic retry logic.
Features
- Paginated Export: Efficiently export large collections using configurable batch sizes
- Retry Logic: Automatic retry mechanism with configurable attempts and delays
- Configurable Delays: Add delays between batches to avoid server overload
- JSON Export: Export data to JSON format using BSON serialization
- CLI Tool: Easy-to-use command-line interface
- Robust Error Handling: Comprehensive logging and error management
Installation
From PyPI
pip install mongoexport
From Source
git clone https://github.com/n1nj4t4nuk1/mongoexport.git
cd mongoexport
pip install -e .
Usage
Command Line
mongoexport \
--uri mongodb://localhost:27017 \
--db mydb \
--collection mycollection \
--batch-size 1000 \
--delay 0.5 \
--retries 3 \
--retry-delay 2.0 \
--output export.json
Option Reference
| Option | Type | Default | Description |
|---|---|---|---|
--uri |
string | required | MongoDB connection URI (e.g., mongodb://localhost:27017) |
--db |
string | required | Database name |
--collection |
string | required | Collection name |
--batch-size |
int | 1000 | Number of documents per batch |
--delay |
float | 0.5 | Delay in seconds between batches |
--retries |
int | 3 | Number of retry attempts for failed batches |
--retry-delay |
float | 2.0 | Delay in seconds before retrying |
--output |
string | output.json | Output file path |
Python Module
from mongoexport import export_data
import argparse
# Create arguments namespace
args = argparse.Namespace(
uri="mongodb://localhost:27017",
db="mydb",
collection="mycollection",
batch_size=1000,
delay=0.5,
retries=3,
retry_delay=2.0,
output="export.json"
)
# Export data
export_data(args)
Requirements
- Python >= 3.8
- pymongo >= 3.12.0
Development
Setup Development Environment
git clone https://github.com/n1nj4t4nuk1/mongoexport.git
cd mongoexport
pip install -e ".[dev]"
Running Tests
pytest
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Issues
If you encounter any issues, please report them on GitHub Issues.
Changelog
Version 0.1.0 (2026-03-18)
- Initial release
- Basic export functionality with pagination
- Retry logic with configurable delays
- CLI interface
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mongoexport-0.1.3.tar.gz.
File metadata
- Download URL: mongoexport-0.1.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53fb306bc13b977f0572919e5e00420f04eea6471c07172d4db5e81c3b786a04
|
|
| MD5 |
3032887b37c2ffe55b2bf2c5c155b13a
|
|
| BLAKE2b-256 |
744839e26fe0cfac8bf8881e5d207a8ad618dda2d9daefdc9557367f1ca39220
|
Provenance
The following attestation bundles were made for mongoexport-0.1.3.tar.gz:
Publisher:
publish.yml on n1nj4t4nuk1/mongoexport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mongoexport-0.1.3.tar.gz -
Subject digest:
53fb306bc13b977f0572919e5e00420f04eea6471c07172d4db5e81c3b786a04 - Sigstore transparency entry: 1121871893
- Sigstore integration time:
-
Permalink:
n1nj4t4nuk1/mongoexport@04216f5173eec9af69faf614c43ba312340c428b -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/n1nj4t4nuk1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@04216f5173eec9af69faf614c43ba312340c428b -
Trigger Event:
release
-
Statement type:
File details
Details for the file mongoexport-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mongoexport-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee00487cc3ebe5755d7c9f2dd4c860d9939e4bfa77a7a62cba1ea163e75a3e77
|
|
| MD5 |
c3dae898fb52c49359bdc678f22b63ec
|
|
| BLAKE2b-256 |
1ea65513c9c7cda9dac54faa9d2d43441d524cc0ccbe8a7210f52441c64c0fcf
|
Provenance
The following attestation bundles were made for mongoexport-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on n1nj4t4nuk1/mongoexport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mongoexport-0.1.3-py3-none-any.whl -
Subject digest:
ee00487cc3ebe5755d7c9f2dd4c860d9939e4bfa77a7a62cba1ea163e75a3e77 - Sigstore transparency entry: 1121871930
- Sigstore integration time:
-
Permalink:
n1nj4t4nuk1/mongoexport@04216f5173eec9af69faf614c43ba312340c428b -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/n1nj4t4nuk1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@04216f5173eec9af69faf614c43ba312340c428b -
Trigger Event:
release
-
Statement type: