File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed
docs/reference/content/driver/tutorials Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -28,19 +28,8 @@ The [aggregation pipeline]({{<docsref "core/aggregation-pipeline" >}}) is a fram
28
28
import com.mongodb.client.model.Accumulators ;
29
29
import com.mongodb.client.model.Projections ;
30
30
import com.mongodb.client.model.Filters ;
31
-
32
- import org.bson.Document ;
33
- ```
34
-
35
- - Include the following code which the examples in the tutorials will use to print the results of the aggregation:
36
31
37
- ```java
38
- Block<Document > printBlock = new Block<Document > () {
39
- @Override
40
- public void apply (final Document document ) {
41
- System . out. println(document. toJson());
42
- }
43
- };
32
+ import org.bson.Document ;
44
33
```
45
34
46
35
## Connect to a MongoDB Deployment
@@ -73,7 +62,7 @@ collection.aggregate(
73
62
Aggregates . match(Filters . eq(" categories" , " Bakery" )),
74
63
Aggregates . group(" $stars" , Accumulators . sum(" count" , 1 ))
75
64
)
76
- ). forEach(printBlock );
65
+ ). forEach(doc - > System . out . println(doc . toJson()) );
77
66
```
78
67
79
68
### Use Aggregation Expressions
@@ -98,7 +87,7 @@ collection.aggregate(
98
87
)
99
88
)
100
89
)
101
- ). forEach(printBlock );
90
+ ). forEach(doc - > System . out . println(doc . toJson()) );
102
91
```
103
92
104
93
### Explain an Aggregation
You can’t perform that action at this time.
0 commit comments