#mongo-db #export #exporter #another #instance #data

bin+lib mongo_data_exporter

A simple MongoDB data exporter to another MongoDB instance

1 unstable release

0.1.3 Jun 21, 2024
0.1.2 Jun 17, 2024
0.1.1 Jun 17, 2024
0.1.0 Jun 17, 2024

#1614 in Database interfaces

Download history 9/week @ 2024-09-10 5/week @ 2024-09-17 8/week @ 2024-09-24 1/week @ 2024-10-01

162 downloads per month

MIT license

19KB
215 lines

Mongo Data Exporter

This is a simple tool to export data from a MongoDB database to another MongoDB database instance. It is fully written in Rust.

crates.io Documentation MSRV dependency status
MIT or Apache 2.0 licensed CI downloads

Dependencies:

[dependencies]
async-trait = "0.1.80"
mongodb = { version = "2.8.2", features = ["bson-chrono-0_4"] }
tokio = { version = "1.38.0", features = ["rt", "rt-multi-thread", "macros"] }
chrono = "0.4.38"
futures = "0.3.30"

Usage:

use mongo_data_exporter::export;
use mongo_data_exporter::operations::{MongoDBConnection, Operation};

#[tokio::main]
async fn main() {
    // Source database connection
    let source_db_dr = MongoDBConnection::new("mongodb://localhost:27017/test", "test", "test-collection").await;
    
    // Target database connection
    let target_db_dr = MongoDBConnection::new("mongodb://localhost2:27017/test", "test", "test-collection").await;

    // Create export operation, you can specify the batch size and the limit data to export
    let mut export_dr = export::Export::init(source_db_dr, target_db_dr, 10000, None).await;
    
    // Start the export operation
    export_dr.start_export().await;
}

License

This project is licensed under either of the following licenses, at your option:

Dependencies

~26–38MB
~690K SLoC