findExtremes method
Implementation
Map<String, num> findExtremes(String field) {
dynamic minValue, maxValue;
for (final document in collection.values) {
final fieldValue = document[field];
if (minValue == null || fieldValue < minValue) {
minValue = fieldValue;
}
if (maxValue == null || fieldValue > maxValue) {
maxValue = fieldValue;
}
}
return {'min': minValue, 'max': maxValue};
}