Skip to content

Commit 8fa7e65

Browse files
refactor: improve lookup challenge scaffolding and notebook guidance
1 parent 74f3144 commit 8fa7e65

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

java/103_aggregation_pipeline_lookup.ipynb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@
128128
"metadata": {},
129129
"source": [
130130
"### 1. Fetch books with their associated reviews\n",
131-
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/lookup#-1-fetch-books-with-their-associated-reviews)"
131+
"\n",
132+
"Bonus: try adding a `$limit` stage as an extra improvement to reduce the output size.\n",
133+
"\n",
134+
"[Solution here](https://mongodb-developer.github.io/sql-to-query-api-lab/docs/aggregation/lookup#-1-fetch-books-with-their-associated-reviews)\n"
132135
]
133136
},
134137
{
@@ -142,7 +145,18 @@
142145
},
143146
"outputs": [],
144147
"source": [
145-
"// type your code here"
148+
"// TYPE YOUR CODE HERE\n",
149+
"\n",
150+
"AggregateIterable<Document> result = books.aggregate(\n",
151+
" List.of(\n",
152+
" <REPLACE_WITH_LOOKUP_STAGE> \n",
153+
" )\n",
154+
");\n",
155+
"\n",
156+
"// Iterate through the results\n",
157+
"for (Document doc : result) {\n",
158+
" System.out.println(\"book: \" + doc.toJson());\n",
159+
"}"
146160
]
147161
}
148162
],

0 commit comments

Comments
 (0)