Skip to content

Commit 8ee84cb

Browse files
committed
redo spacing
1 parent 63c29b5 commit 8ee84cb

File tree

1 file changed

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

1 file changed

+14
-10
lines changed

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use futures::TryStreamExt;
22
use mongodb::{
33
bson::doc,
4-
Client,
5-
Collection,
4+
Client,
5+
Collection,
66
results::{ InsertOneResult, InsertManyResult },
7-
options::{ InsertOneOptions, InsertManyOptions },
7+
options::{ InsertOneOptions, InsertManyOptions },
88
};
99
use std::env;
1010

@@ -14,7 +14,7 @@ use serde::{ Deserialize, Serialize };
1414
struct Book {
1515
_id: i32,
1616
title: String,
17-
author: String,
17+
author: String
1818
}
1919

2020
#[tokio::main]
@@ -32,25 +32,27 @@ async fn main() -> mongodb::error::Result<()> {
3232
// end-insert-one
3333

3434
// begin-one-options
35-
let _result = my_coll.insert_one(doc).bypass_document_validation(true).await?;
35+
let _result = my_coll.insert_one(doc)
36+
.bypass_document_validation(true)
37+
.await?;
3638
// end-one-options
3739

3840
// begin-insert-many
3941
let docs = vec![
4042
Book {
4143
_id: 5,
4244
title: "Cat's Cradle".to_string(),
43-
author: "Kurt Vonnegut Jr.".to_string(),
45+
author: "Kurt Vonnegut Jr.".to_string()
4446
},
4547
Book {
4648
_id: 6,
4749
title: "In Memory of Memory".to_string(),
48-
author: "Maria Stepanova".to_string(),
50+
author: "Maria Stepanova".to_string()
4951
},
5052
Book {
5153
_id: 7,
5254
title: "Pride and Prejudice".to_string(),
53-
author: "Jane Austen".to_string(),
55+
author: "Jane Austen".to_string()
5456
}
5557
];
5658

@@ -62,7 +64,9 @@ async fn main() -> mongodb::error::Result<()> {
6264
// end-insert-many
6365

6466
// begin-many-options
65-
let _result = my_coll.insert_many(docs).comment(Some("hello world".into())).await?;
67+
let _result = my_coll.insert_many(docs)
68+
.comment(Some("hello world".into()))
69+
.await?;
6670
// end-many-options
6771

6872
// begin-unordered
@@ -72,7 +76,7 @@ async fn main() -> mongodb::error::Result<()> {
7276
Book { _id: 1, title: "Blueberries for Sal".to_string(), author: "".to_string() },
7377
Book { _id: 3, title: "Goodnight Moon".to_string(), author: "".to_string() }
7478
];
75-
79+
7680
my_coll.insert_many(docs).ordered(false).await?;
7781
// end-unordered
7882

0 commit comments

Comments
 (0)