【发布时间】:2020-05-21 10:50:59
【问题描述】:
我尝试通过从微调器输入一个值来查询(排序)我在 Firestore 中的一个字段,但我没有让它工作。我应该使用“whereEqualTo”还是“orderBy”?
这是我的代码:
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
firestoreDB.collection("posts")
.whereEqualTo("genre", position)
.get().addOnSuccessListener {
println(it.documents)
}
val type = parent?.getItemAtPosition(position).toString()
Toast.makeText(activity,type, Toast.LENGTH_LONG).show()
}
【问题讨论】:
-
您好,欢迎您,为了改善您在 SO 上的体验,请阅读如何询问On Topic question、Question Check list、the perfect question 以及如何创建Minimal, Complete and Verifiable Example。
标签: firebase kotlin google-cloud-firestore