从子集合中获取数据

时间:2019-05-13 09:39:59

标签: firebase kotlin google-cloud-firestore

当我尝试通过此代码从firestore中的子集合中获取数据时 您遇到问题,并显示以下消息:

  

无效的文档参考。文档引用必须具有偶数个段,但是AppliedJobFromEmployees具有1

fun getData(onComplete: (MutableList<saveApplaiedEmployeeModel>) -> Unit): ListenerRegistration {
        val id = FirebaseAuth.getInstance().currentUser!!.uid
        val doc = FirebaseFirestore.getInstance().collection("AppliedJobFromEmployees/ $employerId/applicants/ $id/EmployeeApplicants")
        return doc.addSnapshotListener { querySnapshot, _ ->
            onComplete(querySnapshot!!.toObjects(saveApplaiedEmployeeModel::class.java))
        }
    }

0 个答案:

没有答案