firebase - 从 Firestore 读取数据
问题描述
我尝试从 Firestore 获取数据并将数据保存在MutableList
其中,并且我使用了与存储数据相同的模型。当我按照代码他们正确读取数组的大小但不将数据读取为空但数据库中的值不是空的。
我需要帮助:
fun getDataQuestions(onComplete: (MutableList<QuestionModel>) -> Unit): ListenerRegistration {
val id = FirebaseAuth.getInstance().currentUser!!.uid
val doc = FirebaseFirestore.getInstance()
.collection("employerUsers").document(id).collection("Question").whereEqualTo("employeeID",this.EmployeeId )
return doc.addSnapshotListener { querySnapshot, firebaseExeption ->
Log.w("firebaseExeption", "" + firebaseExeption)
Log.i("firebaseExeption", "" + querySnapshot)
onComplete(querySnapshot!!.toObjects(QuestionModel::class.java))
}
}
Firestore 屏幕截图
解决方案
推荐阅读
- elasticsearch - 多级嵌套映射和查询上的“映射定义具有不受支持的参数”错误
- python - 如何在文本文件中找到某个字符串的行号?
- html - 图标大小调整?
- javascript - 如何将元素添加到现有对象
- java - 如何在 SpringBoot 1.5.x 中对 HttpMessageConverters 进行排序/排序/优先级
- jquery - Ajax 不发送图像
- swift - 有没有办法在 UserDefaults 中存储 Swift 闭包?
- javascript - javascript中函数的内存表示
- node.js - MongoDB 搜索和分页聚合性能问题
- django - 想要使用装饰器保护匿名用户的视图功能