How can I call aggregate functions for properties of relationships in Realm?
<p>Is there a way to use aggregate functions for properties in a one-to-one and one-to-many relationship? Here's a simple example of the structure I'm using:</p>

<pre><code>class Toy: Object {
    dynamic var purchaseDate: NSDate?
    dynamic var name: String = ""
    let ratings = List&lt;Rating&gt;()
    dynamic var toyOwner: Person?
}

class Rating: Object {
    var stars: Int = 0
    var comments: String?
}

class Person: Object {
    dynamic var name: String = ""
    dynamic var age: Int = 0
}
</code></pre>

<p>I'd like to do something along the lines of this:</p>

<pre><code>// Average age of owner of all toys purchased within a date range
let avgAge: Double = realm.objects(Toy)
    .filter("purchaseDate &gt;= %@ &amp;&amp; purchaseDate &lt;= %@", startDate, endDate)
    .avg("person.age")

// Sum up all stars given to all toys purchased within a date range
let totalStars: Double = realm.objects(Toy)
    .filter("purchaseDate &gt;= %@ &amp;&amp; purchaseDate &lt;= %@", startDate, endDate)
    .sum("sum(ratings.stars)")
</code></pre>

<p>Is there a way to do these aggregate functions within Realm?</p>