Q: Range filter and order by different field Firestore Swift I need to order users by createtAt, but because I need to also query by age-range, first order by need to be on same field, but this ruins the whole concept.
Is it impossible to order by newest users when also using age range on different field or is there a work around this? 
    database.collection("users")
        .whereField("birthday", isGreaterThan: exploreSettings.upperAgeDate)
        .whereField("birthday", isLessThan: exploreSettings.lowerAgeDate)
        .whereField("isHidden", isEqualTo: false)
        .order(by: "birthday")
        .order(by: "createdAt", descending: true)
        .limit(to: 8)
        .start(afterDocument: lastSnapshot)
        .getDocuments {...}


A: Firestore queries can only order on a single field. 
The only way to order over multiple values is find a way to combine the two values into a single field in a meaningful way. So: if you can find a way to express the relation between a birthday and a creation timestamp, you can combine those two values in a single field and order on that.
Note that this is hardly every feasible. The most common example I know of doing this are Geohashes, which combine a latitude and longitude in a way that allows querying for a geographical ranges.
