I'm trying to fetch documents thats belongs to a certain user and just documents which contains status from 1,2,4,5,6 , but instead of getting the documents I'm getting a weird error, this is the code which fetchs for orders with just that status into Firestore
suspend fun getIncompletedOrders(): Resource<List<Order>> {
val reminderList = mutableListOf<Order>()
val query = FirebaseFirestore.getInstance().collection("orders").whereEqualTo("uid",FirebaseAuth.getInstance().currentUser).whereIn("status",
listOf(1,2,4,5,6)).get().await()
for(documents in query.documents){
reminderList.add(documents.toObject(Order::class.java)!!)
}
return Resource.Success(reminderList)
}
This code is throwing the following error
java.lang.StackOverFlowError: stack size 1041KB at com.gogle.firebase.firestore.util.CustomClassMapper$ErrorPath.toString(com.google.firebase:firebase-firestore@@21.4.3:1155)
Firebase Structure
|_ orders
|_ docID
|_ status: 2
|_ uid: userID
Order
data class Order(
val cart: MutableList<Cart> = mutableListOf(),
val shopName:String = "",
val deliveryPrice: Int = 0,
val wantDelivery: Boolean = false,
val address:String = "",
val paymentMethod: Int = 0,
val total: Int = 0,
val uid: String = "",
val status: Int = 0,
)
I dont really know where the problem is