@@ -135,46 +135,80 @@ DELETE FROM reviews WHERE bookId = '0786222727';
135135 ] );
136136 ```
137137 </div >
138+ </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 >
138153 </TabItem >
139- <TabItem value = " csharp" label = " C#" >
140- <div >
141- ```csharp
142- var newReviews = new[ ]
154+ <TabItem value = " python" label = " Python" >
155+ <div >
156+ ```python
157+ reviews = db[ "reviews"]
158+ reviews.insert_many([
143159 {
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 ><TabItem value = " Java" label = " Java" >
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+ ```
185+ </div >
186+ </TabItem >
187+ <TabItem value = " Java" label = " Java" >
154188 <div >
155189 ```Java
156- var reviews = library.getCollection("reviews");
157-
158- reviews.insertMany(List.of(
159- new Document("text", "Thrilling end.")
160- .append("rating", 4)
161- .append("name", "Mark")
162- .append("bookId", "0786222727"),
163-
164- new Document("text", "Very expensive")
165- .append("rating", 3)
166- .append("name", "Yun")
167- .append("bookId", "0786222727"),
168-
169- new Document("text", "Must read!.")
170- .append("rating", 6)
171- .append("name", "Raj")
172- .append("bookId", "0786222727"),
173-
174- new Document("text", "Extremely satisfied with the storyline!")
175- .append("rating", 5)
176- .append("name", "Lisa")
177- .append("bookId", "0786222727")));
190+ var reviews = library.getCollection("reviews");
191+
192+ reviews.insertMany(List.of(
193+ new Document("text", "Thrilling end.")
194+ .append("rating", 4)
195+ .append("name", "Mark")
196+ .append("bookId", "0786222727"),
197+
198+ new Document("text", "Very expensive")
199+ .append("rating", 3)
200+ .append("name", "Yun")
201+ .append("bookId", "0786222727"),
202+
203+ new Document("text", "Must read!.")
204+ .append("rating", 6)
205+ .append("name", "Raj")
206+ .append("bookId", "0786222727"),
207+
208+ new Document("text", "Extremely satisfied with the storyline!")
209+ .append("rating", 5)
210+ .append("name", "Lisa")
211+ .append("bookId", "0786222727")));
178212 ```
179213 </div >
180214 </TabItem >
@@ -203,28 +237,37 @@ DELETE FROM reviews WHERE bookId = '0786222727';
203237 </TabItem >
204238 <TabItem value = " csharp" label = " C#" >
205239 <div >
206- ``` csharp
207- IMongoCollection < Review > reviewsCollection = db .GetCollection <Review >(" reviews" );
240+ ``` csharp
241+ IMongoCollection < Review > reviewsCollection = db .GetCollection <Review >(" reviews" );
208242
209- var deletionResult = reviewsCollection .DeleteMany (r => r .BookId == " 0786222727" );
243+ var deletionResult = reviewsCollection .DeleteMany (r => r .BookId == " 0786222727" );
210244
211- Console .WriteLine ($" {deletionResult .DeletedCount } review(s) deleted." );
212- ```
245+ Console .WriteLine ($" {deletionResult .DeletedCount } review(s) deleted." );
246+ ```
213247 </div >
214- </TabItem ><TabItem value = " Java" label = " Java" >
248+ </TabItem >
249+ <TabItem value = " python" label = " Python" >
215250 <div >
216- ``` Java
217- import static com.mongodb.client.model.Filters.eq ;
218- import org.bson.conversions.Bson ;
251+ ``` python
252+ reviews = db[" reviews" ]
253+ reviews.delete_many({" bookId" : " 0786222727" })
254+ ```
255+ </div >
256+ </TabItem >
257+ <TabItem value = " Java" label = " Java" >
258+ <div >
259+ ``` Java
260+ import static com.mongodb.client.model.Filters.eq ;
261+ import org.bson.conversions.Bson ;
219262
220- MongoCollection<Document > reviews = library. getCollection(" reviews" );
263+ MongoCollection<Document > reviews = library. getCollection(" reviews" );
221264
222- Bson filter = eq(" bookId" , " 0786222727" );
265+ Bson filter = eq(" bookId" , " 0786222727" );
223266
224- DeleteResult result = reviews. deleteMany(filter);
225- System . out. println(result. getDeletedCount() + " reviews deleted." );
267+ DeleteResult result = reviews. deleteMany(filter);
268+ System . out. println(result. getDeletedCount() + " reviews deleted." );
226269 ```
227270 </div >
228271 </TabItem >
229272 </Tabs >
230- </details >
273+ </details >
0 commit comments