new Book("Divine Comedy", "Dante", 1),
new Book("Eclogues", "Dante", 2),
new Book("The Odyssey", "Homer", 10),
new Book("Iliad", "Homer", 10));
AggregationOptions options = AggregationOptions.builder()
.outputMode(AggregationOptions.OutputMode.CURSOR)
.build();
MorphiaIterator<Author, Author> aggregate = getDs().<Book, Author>createAggregation(Book.class)
.group("author", grouping("books", push("title")))
.out(Author.class, options);