aggregate method
Implementation
Future<dynamic> aggregate(
List<Function(List<Map<String, dynamic>>)> stages) async {
List<Map<String, dynamic>> result = List.from(collection.values);
for (final stage in stages) {
await stage(result);
}
return result;
}