@@ -19,8 +19,8 @@ Provides the following:
19
19
20
20
``` toml
21
21
futures = " 0.3"
22
- mongod = { version = " 0.1 " , features = [" derive" ] }
23
- tokio = { version = " 0.2 " , features = [" full" ] }
22
+ mongod = { version = " 0.3 " , features = [" derive" ] }
23
+ tokio = { version = " 1.0 " , features = [" full" ] }
24
24
```
25
25
26
26
``` rust
@@ -48,9 +48,8 @@ async fn main() {
48
48
// Fetch all users in the users collection
49
49
let mut cursor = client . find :: <User , _ >(None ). await . unwrap ();
50
50
while let Some (res ) = cursor . next (). await {
51
- if let Ok (doc ) = res {
52
- let user : User = User :: from_document (doc ). unwrap ();
53
- println! (" {:?}" , user );
51
+ if let Ok ((id , user )) = res {
52
+ println! (" {} - {:?}" , id , user );
54
53
}
55
54
}
56
55
@@ -85,7 +84,7 @@ Example: see above.
85
84
Not everything should be async and for that reason a blocking client is provided that can be used at the same time as the async client.
86
85
87
86
``` toml
88
- mongod = { version = " 0.1 " , features = [" blocking" , " derive" ] }
87
+ mongod = { version = " 0.3 " , features = [" blocking" , " derive" ] }
89
88
```
90
89
91
90
``` rust
@@ -111,9 +110,8 @@ fn main() {
111
110
// Fetch all users in the users collection
112
111
let mut cursor = client . find :: <User , _ >(None ). unwrap ();
113
112
while let Some (res ) = cursor . next () {
114
- if let Ok (doc ) = res {
115
- let user : User = User :: from_document (doc ). unwrap ();
116
- println! (" {:?}" , user );
113
+ if let Ok ((id , user )) = res {
114
+ println! (" {} - {:?}" , user );
117
115
}
118
116
}
119
117
0 commit comments