aggregation groups the elements by a field of their root record