Skip to content

Commit 4840696

Browse files
feat: pr review changes
1 parent bb9b845 commit 4840696

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

docs/50-aggregation/4-group.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ GROUP BY year;
194194
<TabItem value="java" label="Java">
195195
<div>
196196
```java
197+
MongoCollection<Document> reviews = library.getCollection("reviews");
198+
197199
reviews.aggregate(
198200
List.of(
199201
Aggregates.group("$bookId",
@@ -339,7 +341,9 @@ GROUP BY year;
339341
<div>
340342
```java
341343
import static com.mongodb.client.model.Sorts.descending;
342-
344+
345+
MongoCollection<Document> reviews = library.getCollection("reviews");
346+
343347
reviews.aggregate(
344348
List.of(Aggregates.group(
345349
"$name",
@@ -353,6 +357,8 @@ GROUP BY year;
353357
<TabItem value="$sortByCount" label="$sortByCount">
354358
<div>
355359
```java
360+
MongoCollection<Document> reviews = library.getCollection("reviews");
361+
356362
reviews.aggregate(
357363
List.of(
358364
Aggregates.sortByCount("$name"))

docs/50-aggregation/5-lookup.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ The $lookup operation creates an array within each book document. Using $unwind
170170
```java
171171
import com.mongodb.client.model.Aggregates;
172172

173+
MongoCollection<Document> books = library.getCollection("books");
174+
173175
books.aggregate(
174176
List.of(
175177
Aggregates.lookup(

0 commit comments

Comments
 (0)