Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions python/01_connect_database.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@
"#Database name\n",
"db = client[\"library\"]\n",
"\n",
"books = db[\"books\"]\n",
"\n",
"client.close()"
"books = db[\"books\"]"
]
},
{
Expand Down
25 changes: 25 additions & 0 deletions python/103_aggregation_pipeline_lookup.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@
"for f in cursor:\n",
" print(f\"author: {f}.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Challenges"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Fetch books with their associated reviews\n",
"\n",
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/lookup#-1-fetch-books-with-their-associated-reviews)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Type your code here"
]
}
],
"metadata": {
Expand Down
2 changes: 1 addition & 1 deletion python/10_find.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"metadata": {},
"outputs": [],
"source": [
"results = books.find({ \"year\": { \"$gt\" : 2008 }})\n",
"results = books.find({ \"year\": { \"$gt\" : 2008 }}).limit(10)\n",
"\n",
"for f in results:\n",
" print(f) "
Expand Down
2 changes: 1 addition & 1 deletion python/20_project_sort_limit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
" \"pages\": 1\n",
"}\n",
"\n",
"cursor = books.find({}, projection).sort(\"pages\", -1).skip(4).limit(5)\n",
"cursor = books.find({}, projection).sort(\"pages\", -1).skip(4).limit(10)\n",
"\n",
"for book in cursor:\n",
" print(f\"{book['title']}\")"
Expand Down
1 change: 0 additions & 1 deletion python/30_insert.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"metadata": {},
"outputs": [],
"source": [
"from pymongo import MongoClient\n",
"from bson.objectid import ObjectId\n",
"\n",
"#Get the book by its _id from the previous step\n",
Expand Down