minOf() : Find Minimum Property Value
On this page
Summary
Find the minimum (smallest) value of a specific numeric property across all items in a collection.
Signature
minOf(collection, propertyName)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
collection |
Array/Collection | Yes | The collection of objects |
propertyName |
String | Yes | Name of the numeric property to compare |
Returns
Type: Number
The smallest value of the specified property. Returns null for empty collections.
Examples
Lowest Price
Data:
doc.Params["model"] = new {
products = new[] {
new { name = "Widget A", price = 15.50 },
new { name = "Widget B", price = 22.00 },
new { name = "Widget C", price = 8.75 }
}
};
Output:
<p>Lowest price: $8.75</p>
Inventory Low Stock Alert
Data:
doc.Params["model"] = new {
inventory = new[] {
new { sku = "A001", quantity = 45 },
new { sku = "A002", quantity = 5 },
new { sku = "A003", quantity = 32 }
}
};
Output:
<h3>Inventory Status</h3>
<p>Lowest stock level: 5 units</p>
<p style="color: red;">Warning: Low stock detected!</p>
Performance Metrics
Data:
doc.Params["model"] = new {
requests = new[] {
new { endpoint = "/api/users", responseTime = 250 },
new { endpoint = "/api/orders", responseTime = 180 },
new { endpoint = "/api/products", responseTime = 320 }
}
};
Output:
<h3>API Performance</h3>
<p>Fastest response: 180ms</p>
<p>Slowest response: 320ms</p>
<p>Average response: 250ms</p>
Age Range
Data:
doc.Params["model"] = new {
participants = new[] {
new { name = "Alice", age = 28 },
new { name = "Bob", age = 35 },
new { name = "Charlie", age = 22 },
new { name = "Diana", age = 41 }
}
};
Output:
<p>Age range: 22 - 41 years</p>
Notes
- Returns null for empty or null collections
- Property must exist on all items and be numeric
- More concise than
min(collect(collection, 'property')) - Case-sensitive property names
- Useful for:
- Finding lowest prices
- Identifying minimum stock levels
- Performance analysis
- Age/date ranges
- Quality thresholds
- For simple numeric arrays, use
min()instead - For finding the item with minimum value (not just the value), use
sortBy()and access first item