}
@Test
public void distinctOnTypedProperty() throws Exception {
/* given */
collection.save(new Friend("John", new Coordinate(1, 2)));
collection.save(new Friend("Peter", new Coordinate(1, 2)));
collection.save(new Friend("Paul", new Coordinate(125, 72)));
/* when */
Iterator<Coordinate> coordinates = collection.distinct("coordinate").as(Coordinate.class).iterator();
/* then */
Coordinate first = coordinates.next();
assertThat(first.lat).isEqualTo(1);
assertThat(first.lng).isEqualTo(2);
Coordinate second = coordinates.next();
assertThat(second.lat).isEqualTo(125);
assertThat(second.lng).isEqualTo(72);
assertThat(coordinates.hasNext()).isFalse();
}