All of the methods have being deprecated but I havn't been able to find the replacement class for aggregation with the java driver.
Thanks to evanchooly answer, here is what to do.
Replace:
AggregationOutput output = collection.aggregate(pipe);
for (DBObject obj : output.results()) {
//...
}
by
// this build of options is taken from the original method
// aggregate(pipe) to have same behaviour
AggregationOptions options = AggregationOptions.builder()
.outputMode(AggregationOptions.OutputMode.INLINE)
.build();
Cursor cursor = collection.aggregate(pipe,options);
while (cursor.hasNext() ) {
DBObject obj = cursor.next();
//...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With