Skip to content

Commit 77a707a

Browse files
committed
Add python solutions to SELECT challenge
1 parent 58165e2 commit 77a707a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/40-CRUD/2-SELECT.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ 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>
103114
</Tabs>
104115
</details>
105116

@@ -126,5 +137,15 @@ Here:
126137
```
127138
</div>
128139
</TabItem>
140+
<TabItem value="python" label="Python">
141+
<div>
142+
```python
143+
books_with_genre_history = books.find({"genres": "History"}, {"_id": 0, "authors": 0}).limit(10)
144+
145+
for book in books_with_genre_history:
146+
print(book)
147+
```
148+
</div>
149+
</TabItem>
129150
</Tabs>
130151
</details>

0 commit comments

Comments
 (0)