我尝试从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 ScreenShot