@@ -19,8 +19,8 @@ Provides the following:
1919
2020``` toml
2121futures = " 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" ] }
2424```
2525
2626``` rust
@@ -48,9 +48,8 @@ async fn main() {
4848 // Fetch all users in the users collection
4949 let mut cursor = client . find :: <User , _ >(None ). await . unwrap ();
5050 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 );
5453 }
5554 }
5655
@@ -85,7 +84,7 @@ Example: see above.
8584Not 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.
8685
8786``` toml
88- mongod = { version = " 0.1 " , features = [" blocking" , " derive" ] }
87+ mongod = { version = " 0.3 " , features = [" blocking" , " derive" ] }
8988```
9089
9190``` rust
@@ -111,9 +110,8 @@ fn main() {
111110 // Fetch all users in the users collection
112111 let mut cursor = client . find :: <User , _ >(None ). unwrap ();
113112 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 );
117115 }
118116 }
119117
0 commit comments