File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
source/includes/quick-start/code-snippets Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
- use mongodb:: { bson:: doc, Client , Collection } ;
2
- use bson:: Document ;
1
+ use mongodb:: {
2
+ bson:: { Document , doc} ,
3
+ Client ,
4
+ Collection
5
+ } ;
3
6
4
7
#[ tokio:: main]
5
8
async fn main ( ) -> mongodb:: error:: Result < ( ) > {
Original file line number Diff line number Diff line change 1
- use mongodb:: { bson:: doc, sync:: { Client } } ;
2
- use bson:: Document ;
1
+ use mongodb:: {
2
+ bson:: { Document , doc} ,
3
+ sync:: { Client , Collection }
4
+ } ;
3
5
4
6
fn main ( ) -> mongodb:: error:: Result < ( ) > {
5
7
// Replace the placeholder with your Atlas connection string
@@ -10,7 +12,7 @@ fn main() -> mongodb::error::Result<()> {
10
12
11
13
// Get a handle on the movies collection
12
14
let database = client. database ( "sample_mflix" ) ;
13
- let my_coll = database. collection :: < Document > ( "movies" ) ;
15
+ let my_coll: Collection < Document > = database. collection ( "movies" ) ;
14
16
15
17
// Find a movie based on the title value
16
18
let my_movie = my_coll. find_one ( doc ! { "title" : "The Perils of Pauline" } , None ) ?;
You can’t perform that action at this time.
0 commit comments