-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
4 - L (<= 1 quarter)
-
6289
-
Not Needed
We should allow queries to support sorting on a computed property.
This type of advanced sorting would enable use cases like this:
- {{"location geoWithin Geospatial("polygon", [...] SORT(distance(location, GeoPoint(x,y)))" }} // sort by distance function of geospatial point
- "price - discount < 10 SORT(price - discount)" // sort by numeric computation between properties
- "name CONTAINS[c] 'on' SORT(name.@size)" // sort on length of string
- "TRUEPREDICATE SORT(myList.@size)" // sort on size of list property
- "TRUEPREDICATE SORT(myMixedProp.@type ASC, myMixedProp ASC)" // sort on type of mixed property (tracked https://github.com/realm/realm-core/issues/4586)