coll.insert(new MockObject("bar", 101));
coll.insert(new MockObject("bar", 102));
AggregationBuilder<MockObjectAggregationResult> builder = new AggregationBuilder<MockObjectAggregationResult>();
builder.match(new MatchAggregation("string", "foo"))
.group(new GroupAggregation("string").withMin("integer", "integer"));
AggregationResult<MockObjectAggregationResult> aggregationResult = coll.aggregate(builder.build(MockObjectAggregationResult.class));
Assert.assertEquals(1, aggregationResult.results().size());
Assert.assertEquals("foo", aggregationResult.results().get(0)._id);