Skip to content

Commit 2322da0

Browse files
committed
Resolved conflicts after synced updates
1 parent 8f86f38 commit 2322da0

File tree

4 files changed

+110
-107
lines changed

4 files changed

+110
-107
lines changed

docs/40-CRUD/2-SELECT.mdx

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,7 @@ Here:
100100
```
101101
</div>
102102
</TabItem>
103-
<TabItem value="python" label="Python">
104-
<div>
105-
```python
106-
books_with_title_only = books.find({}, {"title": 1, "_id": 0}).limit(10)
107-
108-
for book in books_with_title_only:
109-
print(book)
110-
```
111-
</div>
112-
113-
<TabItem value="csharp" label="C#">
103+
<TabItem value="csharp" label="C#">
114104
<div>
115105
```csharp
116106
var projection = Builders<Book>.Projection.Include(b => b.Title).Exclude(b => b.Id);
@@ -131,6 +121,16 @@ Here:
131121
```
132122
</div>
133123
</TabItem>
124+
<TabItem value="python" label="Python">
125+
<div>
126+
```python
127+
books_with_title_only = books.find({}, {"title": 1, "_id": 0}).limit(10)
128+
129+
for book in books_with_title_only:
130+
print(book)
131+
```
132+
</div>
133+
</TabItem>
134134
</Tabs>
135135
</details>
136136

@@ -157,16 +157,7 @@ Here:
157157
```
158158
</div>
159159
</TabItem>
160-
<TabItem value="python" label="Python">
161-
<div>
162-
```python
163-
books_with_genre_history = books.find({"genres": "History"}, {"_id": 0, "authors": 0}).limit(10)
164-
165-
for book in books_with_genre_history:
166-
print(book)
167-
```
168-
</div>
169-
<TabItem value="csharp" label="C#">
160+
<TabItem value="csharp" label="C#">
170161
<div>
171162
```csharp
172163
var historyGenre = Builders<Book>.Filter.AnyEq(b => b.Genres, "History");
@@ -189,5 +180,15 @@ Here:
189180
```
190181
</div>
191182
</TabItem>
183+
<TabItem value="python" label="Python">
184+
<div>
185+
```python
186+
books_with_genre_history = books.find({"genres": "History"}, {"_id": 0, "authors": 0}).limit(10)
187+
188+
for book in books_with_genre_history:
189+
print(book)
190+
```
191+
</div>
192+
</TabItem>
192193
</Tabs>
193194
</details>

docs/40-CRUD/3-ORDER-LIMIT.mdx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,6 @@ This returns the **top 10 available books** in the "Science Fiction" genre.
8686
```
8787
</div>
8888
</TabItem>
89-
<TabItem value="python" label="Python">
90-
<div>
91-
```python
92-
books_sorted_by_title = books.find({}).sort("title", 1).limit(10)
93-
94-
for book in books_sorted_by_title:
95-
print(book)
96-
```
97-
</div>
9889
<TabItem value="csharp" label="C#">
9990
<div>
10091
```csharp
@@ -108,5 +99,15 @@ This returns the **top 10 available books** in the "Science Fiction" genre.
10899
```
109100
</div>
110101
</TabItem>
102+
<TabItem value="python" label="Python">
103+
<div>
104+
```python
105+
books_sorted_by_title = books.find({}).sort("title", 1).limit(10)
106+
107+
for book in books_sorted_by_title:
108+
print(book)
109+
```
110+
</div>
111+
</TabItem>
111112
</Tabs>
112113
</details>

docs/40-CRUD/4-INSERT-DELETE.mdx

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -136,55 +136,54 @@ DELETE FROM reviews WHERE bookId = '0786222727';
136136
```
137137
</div>
138138
</TabItem>
139+
<TabItem value="csharp" label="C#">
140+
<div>
141+
```csharp
142+
var newReviews = new[]
143+
{
144+
new Review { Text = "Thrilling end.", Rating = 4, Name = "Mark", BookId = "0786222727" },
145+
new Review { Text = "Must read!", Rating = 5, Name = "Raj", BookId = "0786222727" },
146+
new Review { Text = "Very expensive", Rating = 3, Name = "Yun", BookId = "0786222727" },
147+
new Review { Text = "Extremely satisfied with the storyline!", Rating = 5, Name = "Lisa", BookId = "0786222727" }
148+
};
149+
150+
reviewsCollection.InsertMany(newReviews);
151+
```
152+
</div>
153+
</TabItem>
139154
<TabItem value="python" label="Python">
140155
<div>
141-
```python
142-
reviews = db.collection("reviews")
143-
reviews.insert_many([
144-
{
145-
"text": "Thrilling end.",
146-
"rating": 4,
147-
"name": "Mark",
148-
"bookId": "0786222727",
149-
},
150-
{
151-
"text": "Must read!",
152-
"rating": 5,
153-
"name": "Raj",
154-
"bookId": "0786222727",
155-
},
156-
{
157-
"text": "Very expensive",
158-
"rating": 3,
159-
"name": "Yun",
160-
"bookId": "0786222727",
161-
},
162-
{
163-
"text": "Extremely satisfied with the storyline!",
164-
"rating": 5,
165-
"name": "Lisa",
166-
"bookId": "0786222727",
167-
}
168-
])
169-
```
156+
```python
157+
reviews = db.collection("reviews")
158+
reviews.insert_many([
159+
{
160+
"text": "Thrilling end.",
161+
"rating": 4,
162+
"name": "Mark",
163+
"bookId": "0786222727",
164+
},
165+
{
166+
"text": "Must read!",
167+
"rating": 5,
168+
"name": "Raj",
169+
"bookId": "0786222727",
170+
},
171+
{
172+
"text": "Very expensive",
173+
"rating": 3,
174+
"name": "Yun",
175+
"bookId": "0786222727",
176+
},
177+
{
178+
"text": "Extremely satisfied with the storyline!",
179+
"rating": 5,
180+
"name": "Lisa",
181+
"bookId": "0786222727",
182+
}
183+
])
184+
```
170185
</div>
171186
</TabItem>
172-
</TabItem>
173-
<TabItem value="csharp" label="C#">
174-
<div>
175-
```csharp
176-
var newReviews = new[]
177-
{
178-
new Review { Text = "Thrilling end.", Rating = 4, Name = "Mark", BookId = "0786222727" },
179-
new Review { Text = "Must read!", Rating = 5, Name = "Raj", BookId = "0786222727" },
180-
new Review { Text = "Very expensive", Rating = 3, Name = "Yun", BookId = "0786222727" },
181-
new Review { Text = "Extremely satisfied with the storyline!", Rating = 5, Name = "Lisa", BookId = "0786222727" }
182-
};
183-
184-
reviewsCollection.InsertMany(newReviews);
185-
```
186-
</div>
187-
</TabItem>
188187
</Tabs>
189188
</details>
190189

@@ -208,22 +207,23 @@ DELETE FROM reviews WHERE bookId = '0786222727';
208207
```
209208
</div>
210209
</TabItem>
211-
<TabItem value="python" label="Python">
212-
<div>
213-
```python
214-
reviews = db.collection("reviews")
215-
reviews.delete_many({"bookId": "0786222727"})
216-
```
217-
</div>
218210
<TabItem value="csharp" label="C#">
219211
<div>
220-
```csharp
221-
IMongoCollection<Review> reviewsCollection = db.GetCollection<Review>("reviews");
212+
```csharp
213+
IMongoCollection<Review> reviewsCollection = db.GetCollection<Review>("reviews");
222214

223-
var deletionResult = reviewsCollection.DeleteMany(r => r.BookId == "0786222727");
215+
var deletionResult = reviewsCollection.DeleteMany(r => r.BookId == "0786222727");
224216

225-
Console.WriteLine($"{deletionResult.DeletedCount} review(s) deleted.");
226-
```
217+
Console.WriteLine($"{deletionResult.DeletedCount} review(s) deleted.");
218+
```
219+
</div>
220+
</TabItem>
221+
<TabItem value="python" label="Python">
222+
<div>
223+
```python
224+
reviews = db.collection("reviews")
225+
reviews.delete_many({"bookId": "0786222727"})
226+
```
227227
</div>
228228
</TabItem>
229229
</Tabs>

docs/40-CRUD/5-UPDATE.mdx

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,27 @@ Executing the above command will insert a fresh new document in the collection,
9797
</div>
9898
</TabItem>
9999
<TabItem value="mongosh" label="mongosh">
100-
<div>
101-
```js
102-
db.books.updateOne(
103-
{"title": "Treasure of the Sun"},
104-
{$set: {pages: 449}}
105-
);
106-
```
107-
</div>
100+
<div>
101+
```js
102+
db.books.updateOne(
103+
{"title": "Treasure of the Sun"},
104+
{$set: {pages: 449}}
105+
);
106+
```
107+
</div>
108+
</TabItem>
109+
<TabItem value="csharp" label="C#">
110+
<div>
111+
```csharp
112+
var filter = Builders<Book>.Filter.Eq(b => b.Title, "Treasure of the Sun");
113+
var update = Builders<Book>.Update.Set(b => b.Pages, 449);
114+
115+
var result = booksCollection.UpdateOne(filter, update);
116+
117+
// Optionally inspect the outcome
118+
Console.WriteLine($"Matched: {result.MatchedCount}, Modified: {result.ModifiedCount}");
119+
```
120+
</div>
108121
</TabItem>
109122
<TabItem value="python" label="Python">
110123
<div>
@@ -116,18 +129,6 @@ Executing the above command will insert a fresh new document in the collection,
116129
)
117130
```
118131
</div>
119-
<TabItem value="csharp" label="C#">
120-
<div>
121-
```csharp
122-
var filter = Builders<Book>.Filter.Eq(b => b.Title, "Treasure of the Sun");
123-
var update = Builders<Book>.Update.Set(b => b.Pages, 449);
124-
125-
var result = booksCollection.UpdateOne(filter, update);
126-
127-
// Optionally inspect the outcome
128-
Console.WriteLine($"Matched: {result.MatchedCount}, Modified: {result.ModifiedCount}");
129-
```
130-
</div>
131132
</TabItem>
132133
</Tabs>
133134
</details>

0 commit comments

Comments
 (0)