【发布时间】:2018-09-19 13:00:21
【问题描述】:
我需要按 createtAt 对用户进行排序,但是因为我还需要按年龄范围查询,所以第一次排序需要在同一字段上,但这破坏了整个概念。
在不同领域也使用年龄范围时,是否无法由最新用户订购,或者是否有解决方法?
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 {...}
【问题讨论】:
标签: swift firebase google-cloud-firestore