File tree Expand file tree Collapse file tree 3 files changed +16
-16
lines changed
Expand file tree Collapse file tree 3 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,8 @@ Now, translate the following into a MongoDB query.
135135 ``` python
136136 books_with_total_inventory_of_5 = books.find({" totalInventory" : 5 })
137137
138- for book in books_with_total_inventory_of_5:
139- print (f " Book Title: { book[' title' ]} - Total Inventory: { book[' totalInventory' ]} " )
138+ for book in books_with_total_inventory_of_5:
139+ print (f " Book Title: { book[' title' ]} - Total Inventory: { book[' totalInventory' ]} " )
140140 ```
141141 </div >
142142 </TabItem >
@@ -187,10 +187,10 @@ Now, translate the following into a MongoDB query.
187187 <TabItem value = " python" label = " Python" >
188188 <div >
189189 ``` python
190- books_with_more_than_300_pages = books.find({" pages" : {" $gt" : 300 }})
190+ books_with_more_than_300_pages = books.find({" pages" : {" $gt" : 300 }})
191191
192- for book in books_with_more_than_300_pages:
193- print (f " Book Title: { book[' title' ]} - Pages: { book[' pages' ]} " )
192+ for book in books_with_more_than_300_pages:
193+ print (f " Book Title: { book[' title' ]} - Pages: { book[' pages' ]} " )
194194 ```
195195 </div >
196196 </TabItem >
Original file line number Diff line number Diff line change @@ -124,10 +124,10 @@ Here:
124124 <TabItem value = " python" label = " Python" >
125125 <div >
126126 ``` python
127- books_with_title_only = books.find({}, {" title" : 1 , " _id" : 0 }).limit(10 )
127+ books_with_title_only = books.find({}, {" title" : 1 , " _id" : 0 }).limit(10 )
128128
129- for book in books_with_title_only:
130- print (book)
129+ for book in books_with_title_only:
130+ print (book)
131131 ```
132132 </div >
133133 </TabItem >
@@ -183,10 +183,10 @@ Here:
183183 <TabItem value = " python" label = " Python" >
184184 <div >
185185 ``` python
186- books_with_genre_history = books.find({" genres" : " History" }, {" _id" : 0 , " authors" : 0 }).limit(10 )
186+ books_with_genre_history = books.find({" genres" : " History" }, {" _id" : 0 , " authors" : 0 }).limit(10 )
187187
188- for book in books_with_genre_history:
189- print (book)
188+ for book in books_with_genre_history:
189+ print (book)
190190 ```
191191 </div >
192192 </TabItem >
Original file line number Diff line number Diff line change @@ -101,12 +101,12 @@ This returns the **top 10 available books** in the "Science Fiction" genre.
101101 </TabItem >
102102 <TabItem value = " python" label = " Python" >
103103 <div >
104- ``` python
105- books_sorted_by_title = books.find({}).sort(" title" , 1 ).limit(10 )
104+ ``` python
105+ books_sorted_by_title = books.find({}).sort(" title" , 1 ).limit(10 )
106106
107- for book in books_sorted_by_title:
108- print (book)
109- ```
107+ for book in books_sorted_by_title:
108+ print (book)
109+ ```
110110 </div >
111111 </TabItem >
112112 </Tabs >
You can’t perform that action at this time.
0 commit comments