|  | Tempo de execução assíncrono | let result = collection.find_one(doc! { "title": "Peter Pan" }).await?; | 
Tempo de execução da sincronização | let result = collection.find_one(doc! { "title": "Peter Pan" }).run()?; | 
 | 
|  | Tempo de execução assíncrono | let filter = doc! { "year": 1925 }; |  | let mut cursor = collection.find(filter).await?; | 
Tempo de execução da sincronização | let filter = doc! { "year": 1925 }; |  | let mut cursor = collection.find(filter).run()?; | 
 | 
|  | Tempo de execução assíncrono | let doc = doc! { |  | "title": "Mistress America", "type": "movie" |  | }; |  |  |  | let result = collection.insert_one(doc).await?; | 
Tempo de execução da sincronização | let doc = doc! { |  | "title": "Mistress America", "type": "movie" |  | }; |  |  |  | let result = collection.insert_one(doc).run()?; | 
 | 
| Insert Multiple Documents 
 | Tempo de execução assíncrono | let docs = vec![ |  | doc! { "title": "Friends With Money", "runtime": 88 }, |  | doc! { "title": "Please Give", "runtime": 90 }, |  | doc! { "title": "You Hurt My Feelings", "runtime": 93 }, |  | ]; |  |  |  | let result = collection.insert_many(docs).await?; | 
Tempo de execução da sincronização | let docs = vec![ |  | doc! { "title": "Friends With Money", "runtime": 88 }, |  | doc! { "title": "Please Give", "runtime": 90 }, |  | doc! { "title": "You Hurt My Feelings", "runtime": 93 }, |  | ]; |  |  |  | let result = collection.insert_many(docs).run()?; | 
 | 
|  | Tempo de execução assíncrono | let filter = doc! { "title": "Burn After Reading"}; |  | let update = doc! { |  | "$set": doc!{ "num_mflix_comments": 1 } |  | }; |  |  |  | let result = collection.update_one(filter, update).await?; | 
Tempo de execução da sincronização | let filter = doc! { "title": "Burn After Reading"}; |  | let update = doc! { |  | "$set": doc!{ "num_mflix_comments": 1 } |  | }; |  |  |  | let result = collection.update_one(filter, update).run()?; | 
 | 
| Update Multiple Documents 
 | Tempo de execução assíncrono | let filter = doc! { "rated": "PASSED"}; |  | let update = doc! { |  | "$set": doc!{ "rated": "Not Rated" } |  | }; |  |  |  | let result = collection.update_many(filter, update).await?; | 
Tempo de execução da sincronização | let filter = doc! { "rated": "PASSED"}; |  | let update = doc! { |  | "$set": doc!{ "rated": "Not Rated" } |  | }; |  |  |  | let result = collection.update_many(filter, update).run()?; | 
 | 
|  | Tempo de execução assíncrono | let filter = doc! { "title": "è Nous la Libertè" }; |  | let replacement = doc! { |  | "title": "À nous la liberté", |  | "type": "movie", |  | "directors": vec! [ "René Clair" ] |  | }; |  |  |  | let result = collection.replace_one(filter, replacement).await?; | 
Tempo de execução da sincronização | let filter = doc! { "title": "è Nous la Libertè" }; |  | let replacement = doc! { |  | "title": "À nous la liberté", |  | "type": "movie", |  | "directors": vec! [ "René Clair" ] |  | }; |  |  |  | let result = collection.replace_one(filter, replacement).run()?; | 
 | 
|  | Tempo de execução assíncrono | let filter = doc! { "title": "Search and Destroy" }; |  | let result = collection.delete_one(filter).await?; | 
Tempo de execução da sincronização | let filter = doc! { "title": "Search and Destroy" }; |  | let result = collection.delete_one(filter).run()?; | 
 | 
| Delete Multiple Documents 
 | Tempo de execução assíncrono | let filter = doc! { |  | "year": doc! { "$lt": 1920 } |  | }; |  |  |  | let result = collection.delete_many(filter).await?; | 
Tempo de execução da sincronização | let filter = doc! { |  | "year": doc! { "$lt": 1920 } |  | }; |  |  |  | let result = collection.delete_many(filter).run()?; | 
 | 
| Access Data from a Cursor Iteratively 
 | Tempo de execução assíncrono | let mut cursor = collection |  | .find(doc! { "$and": vec! |  | [ |  | doc! { "metacritic": doc! { "$gt": 90 } }, |  | doc! { "directors": vec! [ "Martin Scorsese" ] } |  | ] }) |  | .await?; |  |  |  | while let Some(result) = cursor.try_next().await? { |  | println!("{}", result); |  | } | 
Tempo de execução da sincronização | let cursor = collection |  | .find(doc! { "$and": vec! |  | [ |  | doc! { "metacritic": doc! { "$gt": 90 } }, |  | doc! { "directors": vec! [ "Martin Scorsese" ] } |  | ] }) |  | .run()?; |  |  |  | for result in cursor { |  | println!("{}", result?); |  | } | 
 | 
| Access Data from a Cursor as an Array 
 | Tempo de execução assíncrono | let cursor = collection.find(doc! { "title": "Secrets & Lies" }).await?; |  |  |  | let results: Vec<Document> = cursor.try_collect().await?; | 
Tempo de execução da sincronização | let cursor = collection.find(doc! { "title": "Secrets & Lies" }).run()?; |  |  |  | let results: Vec<Result<Document>> = cursor.collect(); | 
 | 
|  | Tempo de execução assíncrono | let filter = doc! { |  | "languages": vec! [ "Mandarin" ] |  | }; |  |  |  | let result = collection.count_documents(filter).await?; | 
Tempo de execução da sincronização | let filter = doc! { |  | "languages": vec! [ "Mandarin" ] |  | }; |  |  |  | let result = collection.count_documents(filter).run()?; | 
 | 
| List Distinct Values of a Field 
 | Tempo de execução assíncrono | let field_name = "title"; |  | let filter = doc! { |  | "directors": vec! [ "Sean Baker" ] |  | }; |  |  |  | let results = collection.distinct(field_name, filter).await?; | 
Tempo de execução da sincronização | let field_name = "title"; |  | let filter = doc! { |  | "directors": vec! [ "Sean Baker" ] |  | }; |  |  |  | let results = collection.distinct(field_name, filter).run()?; | 
 | 
| Limit the Number of Documents Retrieved 
 | Tempo de execução assíncrono | let filter = doc! { "awards.wins": 25}; |  | let mut cursor = collection.find(filter).limit(5).await?; | 
Tempo de execução da sincronização | let filter = doc! { "awards.wins": 25}; |  | let mut cursor = collection.find(filter).limit(5).run()?; | 
 | 
|  | Tempo de execução assíncrono | let filter = doc! { "runtime": 100 }; |  | let mut cursor = collection.find(filter).skip(1).await?; | 
Tempo de execução da sincronização | let filter = doc! { "runtime": 100 }; |  | let mut cursor = collection.find(filter).skip(1).run()?; | 
 | 
| Sort the Documents When Retrieving Them 
 | Tempo de execução assíncrono | let filter = doc! { |  | "directors": vec! [ "Nicole Holofcener" ] |  | }; |  |  |  | let mut cursor = collection |  | .find(filter) |  | .sort(doc! { "imdb.rating": 1 }) |  | .await?; | 
Tempo de execução da sincronização | let filter = doc! { |  | "directors": vec! [ "Nicole Holofcener" ] |  | }; |  |  |  | let mut cursor = collection |  | .find(filter) |  | .sort(doc! { "imdb.rating": 1 }) |  | .run()?; | 
 | 
| Project Document Fields When Retrieving Them 
 | Tempo de execução assíncrono | let filter = doc! { "year": 2015 }; |  | let mut cursor = collection |  | .find(filter) |  | .projection(doc! { "title": 1, "metacritic": 1, "_id": 0 }) |  | .await?; | 
Tempo de execução da sincronização | let filter = doc! { "year": 2015 }; |  | let mut cursor = collection |  | .find(filter) |  | .projection(doc! { "title": 1, "metacritic": 1, "_id": 0 }) |  | .run()?; | 
 | 
|  | Tempo de execução assíncrono | let index: IndexModel = IndexModel::builder().keys(doc! { "title": 1 }).build(); |  |  |  | let result = collection.create_index(index).await?; | 
Tempo de execução da sincronização | let index: IndexModel = IndexModel::builder().keys(doc! { "title": 1 }).build(); |  |  |  | let result = collection.create_index(index).run()?; | 
 |