Skip to main content

🍃 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/otsobide/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/otsobide/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.4 (2026-08-24)

  • Update project URLs to the otsobide GitHub account
  • Fix the LICENSE link in this README
  • Sync __version__ with the packaged version
  • No functional changes to the export logic

Version 0.1.0 (2026-03-18)

  • Initial release
  • Basic export functionality with pagination
  • Retry logic with configurable delays
  • CLI interface

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongoexport-0.1.4.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mongoexport-0.1.4-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file mongoexport-0.1.4.tar.gz.

File metadata

  • Download URL: mongoexport-0.1.4.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mongoexport-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b6ffdd4ca8af376470db1e1e4f406a18c573c1e71b3da119b340187737985072
MD5 39a32416d33b8eb789ad09bcdf854c67
BLAKE2b-256 9ebb28f6380114a61b0f10026cd110fee40997b54e77456d53e52aea305f4ccf

See more details on using hashes here.

Provenance

The following attestation bundles were made for mongoexport-0.1.4.tar.gz:

Publisher: publish.yml on otsobide/mongoexport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mongoexport-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: mongoexport-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mongoexport-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 418a3e9ff07322349ede5ffd4e8b11c8bb9744776370d0afef8a3de43d32b691
MD5 7e1c76d0bd3231204f9b1eb9bb993ff4
BLAKE2b-256 4b441516f706fc4347bc5e14eaf65d4809444ab82fff3161fb903c77215de7d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for mongoexport-0.1.4-py3-none-any.whl:

Publisher: publish.yml on otsobide/mongoexport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page