Reverse nested aggregation support

Closes #828