Skip to content

Commit 431cd59

Browse files
Merge pull request #12 from mongodb-developer/fix/quick-fix
Added summary at the bottom of the page
2 parents 56975f7 + 1cac7da commit 431cd59

6 files changed

Lines changed: 48 additions & 8 deletions

java/100_aggregation_pipeline_match.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@
260260
"source": [
261261
"### Find books with more than 2 available copies.\n",
262262
"\n",
263+
"Hint: use `limit()` to keep the result easier to inspect.\n",
264+
"\n",
263265
"[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)"
264266
]
265267
},
@@ -278,8 +280,7 @@
278280
"\n",
279281
"AggregateIterable<Document> result = books.aggregate(\n",
280282
" List.of(\n",
281-
" <REPLACE_WITH_MATCH_STAGE>,\n",
282-
" <REPLACE_WITH_LIMIT_STAGE>\n",
283+
" <REPLACE_WITH_MATCH_STAGE>\n",
283284
" ) \n",
284285
");\n",
285286
"\n",
@@ -295,6 +296,8 @@
295296
"source": [
296297
"### Find books with more than 2 available copies. Return only book titles and publication year.\n",
297298
"\n",
299+
"Hint: use `limit()` to keep the result easier to inspect.\n",
300+
"\n",
298301
"[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)"
299302
]
300303
},
@@ -314,8 +317,7 @@
314317
"AggregateIterable<Document> result = books.aggregate(\n",
315318
" List.of(\n",
316319
" <REPLACE_WITH_MATCH_STAGE>,\n",
317-
" <REPLACE_WITH_PROJECT_STAGE>,\n",
318-
" <REPLACE_WITH_LIMIT_STAGE>\n",
320+
" <REPLACE_WITH_PROJECT_STAGE>\n",
319321
" )\n",
320322
");\n",
321323
"\n",

java/101_aggregation_pipeline_unwind.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@
166166
" System.out.println(\"book: \" + doc.toJson());\n",
167167
"}"
168168
]
169+
},
170+
{
171+
"cell_type": "markdown",
172+
"id": "bb2a9a13",
173+
"metadata": {},
174+
"source": [
175+
"## Summary\n",
176+
"\n",
177+
"With `$unwind`, we can deconstruct an array field and return one document for each element in the array, making it easier to work with array values individually."
178+
]
169179
}
170180
],
171181
"metadata": {

java/102_aggregation_pipeline_lookup.ipynb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"source": [
143143
"### 1. Fetch books with their associated reviews\n",
144144
"\n",
145-
"Bonus: try adding a `$limit` stage as an extra improvement to reduce the output size.\n",
145+
"Bonus: We are adding a `limit()` stage as an extra improvement to reduce the output size.\n",
146146
"\n",
147147
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/lookup#-1-fetch-books-with-their-associated-reviews)\n"
148148
]
@@ -172,6 +172,16 @@
172172
" System.out.println(\"book: \" + doc.toJson());\n",
173173
"}"
174174
]
175+
},
176+
{
177+
"cell_type": "markdown",
178+
"id": "7412bef4",
179+
"metadata": {},
180+
"source": [
181+
"## Summary\n",
182+
"\n",
183+
"With `$lookup`, we can join documents from another collection and add the matching results to a new array field in the current document."
184+
]
175185
}
176186
],
177187
"metadata": {

java/103_aggregation_pipeline_group_by.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@
216216
" System.out.println(\"user: \" + doc.toJson());\n",
217217
"}"
218218
]
219+
},
220+
{
221+
"cell_type": "markdown",
222+
"id": "e208abce",
223+
"metadata": {},
224+
"source": [
225+
"## Summary\n",
226+
"\n",
227+
"With `$group`, we can group documents by a field or expression and calculate aggregated values such as counts, sums, and averages for each group."
228+
]
219229
}
220230
],
221231
"metadata": {

java/104_aggregation_pipeline_set.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@
136136
"source": [
137137
"## Summary\n",
138138
"\n",
139-
"`$set` keeps the original fields and adds the new field to each document.\n",
140-
"\n",
141-
"At the end of the pipeline, each review still contains its original fields, plus the new `reviewYear` field derived from `timestamp`."
139+
"With `$set`, we can add a new field to each document or update the value of an existing one while keeping the original fields in the result."
142140
]
143141
}
144142
],

java/106_aggregation_pipeline_arrays.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,16 @@
261261
" System.out.println(\"book: \" + doc.toJson());\n",
262262
"}"
263263
]
264+
},
265+
{
266+
"cell_type": "markdown",
267+
"id": "cb4c4b0d",
268+
"metadata": {},
269+
"source": [
270+
"## Summary\n",
271+
"\n",
272+
"With `$match` and array operators such as `$all` and `$in`, we can filter documents based on the values stored inside array fields."
273+
]
264274
}
265275
],
266276
"metadata": {

0 commit comments

Comments
 (0)