Skip to content

Commit c79d10e

Browse files
authored
DOCSP-30540: Insert guide tech review (#45)
1 parent 2248436 commit c79d10e

File tree

1 file changed

+5
-5
lines changed
  • source/includes/fundamentals/code-snippets/crud

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ async fn main() -> mongodb::error::Result<()> {
1818
let my_coll: Collection<Document> = client.database("db").collection("books");
1919
let doc = doc! { "title": "Atonement", "author": "Ian McEwan" };
2020

21-
let insert_one_result: InsertOneResult = my_coll.insert_one(doc, None).await?;
21+
let insert_one_result = my_coll.insert_one(doc, None).await?;
2222
println!("Inserted document with _id: {}", insert_one_result.inserted_id);
2323
// end-insert-one
2424

2525
// begin-one-options
26-
let _opts: InsertOneOptions = InsertOneOptions::builder()
26+
let _opts = InsertOneOptions::builder()
2727
.bypass_document_validation(true)
2828
.build();
2929
// end-one-options
@@ -36,15 +36,15 @@ async fn main() -> mongodb::error::Result<()> {
3636
doc! { "title": "Pride and Prejudice", "author": "Jane Austen" }
3737
];
3838

39-
let insert_many_result: InsertManyResult = my_coll.insert_many(docs, None).await?;
39+
let insert_many_result = my_coll.insert_many(docs, None).await?;
4040
println!("Inserted documents with _ids:");
4141
for (_key, value) in &insert_many_result.inserted_ids {
4242
println!("{}", value);
4343
}
4444
// end-insert-many
4545

4646
// begin-many-options
47-
let _opts: InsertManyOptions = InsertManyOptions::builder()
47+
let _opts = InsertManyOptions::builder()
4848
.comment(bson!("hello world"))
4949
.build();
5050
// end-many-options
@@ -57,7 +57,7 @@ async fn main() -> mongodb::error::Result<()> {
5757
doc! { "_id": 3, "title": "Goodnight Moon" }
5858
];
5959

60-
let opts: InsertManyOptions = InsertManyOptions::builder().ordered(false).build();
60+
let opts = InsertManyOptions::builder().ordered(false).build();
6161
my_coll.insert_many(docs, opts).await?;
6262
// end-unordered
6363

0 commit comments

Comments
 (0)