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
56 changes: 56 additions & 0 deletions java/100_aggregation_pipeline_match.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,62 @@
" System.out.println(\"book: \" + doc.toJson());\n",
"}"
]
},
{
"cell_type": "markdown",
"id": "e036292d",
"metadata": {},
"source": [
"## Challenges"
]
},
{
"cell_type": "markdown",
"id": "a990232f",
"metadata": {},
"source": [
"### Find books with more than 2 available copies.\n",
"\n",
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/match-project#-1-find-books-with-more-than-2-available-copies)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "86121908",
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"// type your code here"
]
},
{
"cell_type": "markdown",
"id": "09e83abe",
"metadata": {},
"source": [
"### Find books with more than 2 available copies. Return only book titles and publication year.\n",
"\n",
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/match-project#-2-find-books-with-more-than-2-available-copies-return-only-book-titles-and-publication-year)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9e036fa7",
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"// type your code here"
]
}
],
"metadata": {
Expand Down
54 changes: 54 additions & 0 deletions java/101_aggregation_pipeline_arrays.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,60 @@
" System.out.println(\"book: \" + doc.toJson());\n",
"}"
]
},
{
"cell_type": "markdown",
"id": "d2f8a2de",
"metadata": {},
"source": [
"## Challenge"
]
},
{
"cell_type": "markdown",
"id": "eae3a6b1",
"metadata": {},
"source": [
"### 1. After the year 2000, which book has the most number of authors? (Using $project)\n",
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/sort-limit#-1-after-the-year-2000-which-book-has-the-most-number-of-authors)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a9156af7",
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"// type your code here"
]
},
{
"cell_type": "markdown",
"id": "652df0c6",
"metadata": {},
"source": [
"### 2. After the year 2000, which book has the most number of authors? (Using $addFields)\n",
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/sort-limit#-1-after-the-year-2000-which-book-has-the-most-number-of-authors)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3c4cea9c",
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"// type your code here"
]
}
],
"metadata": {
Expand Down
31 changes: 31 additions & 0 deletions java/103_aggregation_pipeline_lookup.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,37 @@
" System.out.println(\"book: \" + doc.toJson());\n",
"}"
]
},
{
"cell_type": "markdown",
"id": "b45d499e",
"metadata": {},
"source": [
"## Challenge"
]
},
{
"cell_type": "markdown",
"id": "eca1333b",
"metadata": {},
"source": [
"### 1. Fetch books with their associated reviews\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,
"id": "b6327590",
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"// type your code here"
]
}
],
"metadata": {
Expand Down
71 changes: 66 additions & 5 deletions java/104_aggregation_pipeline_group_by.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@
"cell_type": "code",
"execution_count": null,
"id": "66ef28c4-f86b-4576-839e-100a7ae022c7",
"metadata": {
"vscode": {
"languageId": "java"
}
},
"metadata": {},
"outputs": [],
"source": [
"// Import the MongoDB Driver using Maven\n",
Expand Down Expand Up @@ -93,6 +89,71 @@
" System.out.println(\"book: \" + doc.toJson());\n",
"}"
]
},
{
"cell_type": "markdown",
"id": "33300d88",
"metadata": {},
"source": [
"## Challenge"
]
},
{
"cell_type": "markdown",
"id": "d96043ab",
"metadata": {},
"source": [
"### 1. Find the average book rating of all books\n",
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/group#-1-find-the-average-book-rating-of-all-books)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c0bd8122",
"metadata": {},
"outputs": [],
"source": [
"// type your code here"
]
},
{
"cell_type": "markdown",
"id": "2b9bb53e",
"metadata": {},
"source": [
"### 2. Find users with the most number of reviews (Hint: use sum + sort)\n",
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/group#-2-find-users-with-the-most-number-of-reviews-hint-use-the-name-field-in-the-reviews-collection)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1ca60877",
"metadata": {},
"outputs": [],
"source": [
"// type your code here"
]
},
{
"cell_type": "markdown",
"id": "74e33d58",
"metadata": {},
"source": [
"### 3. Find users with the most number of reviews (Hint: use $sortByCount)\n",
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/group#-2-find-users-with-the-most-number-of-reviews-hint-use-the-name-field-in-the-reviews-collection)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e38a71b5",
"metadata": {},
"outputs": [],
"source": [
"// type your code here"
]
}
],
"metadata": {
Expand Down
Loading