aggregateCount method
Implementation
Map<dynamic, int> aggregateCount(String fieldName) {
final Map<dynamic, int> counts = {};
for (final document in collection.values) {
final fieldValue = document[fieldName];
if (!counts.containsKey(fieldValue)) {
counts[fieldValue] = 0;
}
counts[fieldValue] = counts[fieldValue]! + 1;
}
return counts;
}