-
-
Save PegasisForever/95ca0e3cb25336f9f48227a090ef41ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use mongodb::options::ClientOptions; | |
use mongodb::Client; | |
use mongodb::bson::doc; | |
use mongodb::bson::Document; | |
use std::time::Duration; | |
#[tokio::main] | |
async fn main() { | |
{ | |
let mongo_options = ClientOptions::parse("mongodb://root:password@localhost:27018").await.unwrap(); | |
let mongo_client = Client::with_options(mongo_options).unwrap(); | |
let collection = mongo_client.database("test_db").collection("test"); | |
let mut documents = vec![]; | |
for _ in 0i32..=30000i32 { | |
let document: Document = doc! { | |
"a": 1, | |
"b": 1, | |
"c": 1, | |
"d": 1, | |
"e": 1, | |
"f": 1, | |
"g": 1, | |
"h": 1, | |
"i": 1, | |
"j": 1, | |
"k": 1, | |
}; | |
documents.push(document); | |
} | |
collection.insert_many(documents, None).await.unwrap(); | |
} | |
println!("dropped"); | |
tokio::time::delay_for(Duration::from_secs(60)).await; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment