File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,16 @@ Now, translate the following into a MongoDB query.
130130 ```
131131 </div >
132132 </TabItem >
133+ <TabItem value = " python" label = " Python" >
134+ <div >
135+ ``` python
136+ books_with_total_inventory_of_5 = books.find({" totalInventory" : 5 })
137+
138+ for book in books_with_total_inventory_of_5:
139+ print (f " Book Title: { book[' title' ]} - Total Inventory: { book[' totalInventory' ]} " )
140+ ```
141+ </div >
142+ </TabItem >
133143 </Tabs >
134144
135145</details >
@@ -174,6 +184,16 @@ Now, translate the following into a MongoDB query.
174184 ```
175185 </div >
176186 </TabItem >
187+ <TabItem value = " python" label = " Python" >
188+ <div >
189+ ``` python
190+ books_with_more_than_300_pages = books.find({" pages" : {" $gt" : 300 }})
191+
192+ for book in books_with_more_than_300_pages:
193+ print (f " Book Title: { book[' title' ]} - Pages: { book[' pages' ]} " )
194+ ```
195+ </div >
196+ </TabItem >
177197 </Tabs >
178198</details >
179199
@@ -216,5 +236,15 @@ Now, translate the following into a MongoDB query.
216236 ```
217237 </div >
218238 </TabItem >
239+ <TabItem value = " python" label = " Python" >
240+ <div >
241+ ``` python
242+ books_with_genre_science_and_more_than_300_pages = books.find({" genres" : " Science" , " pages" : {" $gt" : 300 }})
243+
244+ for book in books_with_genre_science_and_more_than_300_pages:
245+ print (f " Book Title: { book[' title' ]} - Pages: { book[' pages' ]} " )
246+ ```
247+ </div >
248+ </TabItem >
219249 </Tabs >
220250</details >
You can’t perform that action at this time.
0 commit comments