@Override
    public void process(Consumer<Bson> consumer) {
      query.limit().ifPresent(limit -> consumer.accept(Aggregates.limit((int) limit)));
    }
Converts query of type {@code select distinct a, b, c from table} to {@code select a, b, c from table group by a, b, c}
so same pipelines (like {@link Group}) can be (re-)used. Does nothing if this is not a {@code distinct} query.
@param query query to be converted
@return new version of the query with projections copied to {@code groupBy} list or unmodified query.
@throws UnsupportedOperationException if query is "distinct" and {@code groupBy} is not empty
criteria/mongo/src/org/immutables/criteria/mongo/AggregationQuery.java