【发布时间】:2021-12-22 12:47:10
【问题描述】:
当我在 Firestore 中使用以下查询时,出现了一个错误:
代码:
query = database.collection("CustomerViews/Data/Post")
.whereGreaterThanOrEqualTo("postDate", startDate)
.whereLessThanOrEqualTo("postDate", endDate)
.orderBy("postViews", Query.Direction.DESCENDING)
.orderBy("postDate", Query.Direction.DESCENDING)
错误:
Invalid query. You have an inequality where filter (whereLessThan(), whereGreaterThan(), etc.) on field 'postDate'
and so you must also have 'postDate' as your first orderBy() field, but your first orderBy() is currently on field
'postViews' instead.
【问题讨论】:
标签: android firebase kotlin google-cloud-platform google-cloud-firestore