Skip to content

Commit 79d1e26

Browse files
authored
DOCSP-30544: compound pr review (#42)
1 parent 6c53ccb commit 79d1e26

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

source/fundamentals/crud/compound-operations.txt

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,9 @@ field is less than or equal to ``10``:
194194
:visible: false
195195

196196
Deleted document:
197-
{
198-
"_id": { ... },
199-
"name": "Deanna Porowski",
200-
"age": 10,
201-
"school": "Lakeside Elementary"
202-
}
197+
Some(Document({"_id": ObjectId("..."),
198+
"name": String("Deanna Porowski"), "age": Int32(10), "school":
199+
String("Lakeside Elementary")}))
203200

204201
.. _rust-find-and-update:
205202

@@ -356,12 +353,9 @@ following parameters:
356353
:visible: false
357354

358355
Updated document:
359-
{
360-
"_id": { ... },
361-
"name": "Ben Joseph",
362-
"age": 17,
363-
"school": "Durango High School"
364-
}
356+
Some(Document({"_id": ObjectId("..."),
357+
"name": String("Ben Joseph"), "age": Int32(17), "school":
358+
String("Durango High School")}))
365359

366360
.. _rust-find-and-replace:
367361

@@ -513,10 +507,8 @@ following parameters:
513507
:visible: false
514508

515509
Document after replacement:
516-
{
517-
"name": "Toby Fletcher",
518-
"school": "Durango High School"
519-
}
510+
Some(Document({"name": String("Toby Fletcher"), "school":
511+
String("Durango High School")}))
520512

521513
.. _rust-crud-compound-addtl-info:
522514

source/includes/fundamentals/code-snippets/crud/change.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async fn main() -> mongodb::error::Result<()> {
4141

4242
// begin-options
4343
let opts: UpdateOptions = UpdateOptions::builder().upsert(true).build();
44-
let _res = my_coll.update_one(filter_doc, update_doc, opts).await?;
44+
let res = my_coll.update_one(filter_doc, update_doc, opts).await?;
4545
// end-options
4646

4747
Ok(())

source/includes/fundamentals/code-snippets/crud/compound.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ async fn main() -> mongodb::error::Result<()> {
2121
let filter = doc! { "name": "xxx" };
2222
// begin-find-delete-options
2323
let opts = FindOneAndDeleteOptions::builder().comment(bson!("hello")).build();
24-
let _res = my_coll.find_one_and_delete(filter, opts).await?;
24+
let res = my_coll.find_one_and_delete(filter, opts).await?;
2525
// end-find-delete-options
2626

2727
// begin-find_one_and_delete
2828
let filter = doc! { "age": doc! { "$lte": 10 } };
2929

3030
let res = my_coll.find_one_and_delete(filter, None).await?;
31-
println!("Deleted document:\n{}", serde_json::to_string_pretty(&res).unwrap());
31+
println!("Deleted document:\n{:?}", res);
3232
// end-find_one_and_delete
3333

3434
let filter = doc! { "name": "xxx" };
3535
let update = doc! { "$set": doc! { "check": true } };
3636
// begin-find-update-options
3737
let opts = FindOneAndUpdateOptions::builder().comment(bson!("hello")).build();
38-
let _res = my_coll.find_one_and_update(filter, update, opts).await?;
38+
let res = my_coll.find_one_and_update(filter, update, opts).await?;
3939
// end-find-update-options
4040

4141
// begin-find_one_and_update
@@ -48,14 +48,14 @@ async fn main() -> mongodb::error::Result<()> {
4848
.build();
4949

5050
let res = my_coll.find_one_and_update(filter, update, opts).await?;
51-
println!("Updated document:\n{}", serde_json::to_string_pretty(&res).unwrap());
51+
println!("Updated document:\n{:?}", res);
5252
// end-find_one_and_update
5353

5454
let filter = doc! { "name": "xxx" };
5555
let replacement = doc! { "name": "yyy", "age": 10 };
5656
// begin-find-replace-options
5757
let opts = FindOneAndReplaceOptions::builder().comment(bson!("hello")).build();
58-
let _res = my_coll.find_one_and_replace(filter, replacement, opts).await?;
58+
let res = my_coll.find_one_and_replace(filter, replacement, opts).await?;
5959
// end-find-replace-options
6060

6161
// begin-find_one_and_replace
@@ -70,7 +70,7 @@ async fn main() -> mongodb::error::Result<()> {
7070
.build();
7171

7272
let res = my_coll.find_one_and_replace(filter, replacement, opts).await?;
73-
println!("Document after replacement:\n{}", serde_json::to_string_pretty(&res).unwrap());
73+
println!("Document after replacement:\n{:?}", res);
7474
// end-find_one_and_replace
7575

7676
Ok(())

0 commit comments

Comments
 (0)