Skip to content

Commit cf13273

Browse files
committed
DOCSP-34338: Update Quick Start code (#84)
(cherry picked from commit 4f1165e)
1 parent 2e948b3 commit cf13273

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

source/includes/quick-start/code-snippets/connect-async.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
use mongodb::{ bson::doc, Client, Collection };
2-
use bson::Document;
1+
use mongodb::{
2+
bson::{Document, doc},
3+
Client,
4+
Collection
5+
};
36

47
#[tokio::main]
58
async fn main() -> mongodb::error::Result<()> {

source/includes/quick-start/code-snippets/connect-sync.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
use mongodb::{ bson::doc, sync::{ Client } };
2-
use bson::Document;
1+
use mongodb::{
2+
bson::{Document, doc},
3+
sync::{Client, Collection}
4+
};
35

46
fn main() -> mongodb::error::Result<()> {
57
// Replace the placeholder with your Atlas connection string
@@ -10,7 +12,7 @@ fn main() -> mongodb::error::Result<()> {
1012

1113
// Get a handle on the movies collection
1214
let database = client.database("sample_mflix");
13-
let my_coll = database.collection::<Document>("movies");
15+
let my_coll: Collection<Document> = database.collection("movies");
1416

1517
// Find a movie based on the title value
1618
let my_movie = my_coll.find_one(doc! { "title": "The Perils of Pauline" }, None)?;

0 commit comments

Comments
 (0)