Get data from subcollection

Asked by At

When I try get data from sub collection in firestore through this code You get a problem and this message appears:

Invalid document reference. Document references must have an even number of segments, but AppliedJobFromEmployees has 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 Answers