Multiple orderBy() not working in cloud firestore database

Viewed 246

Making a query on firestore which consists of multiple orderBy().

val TAG = "TAG"
val firestore: FirebaseFirestore = FirebaseFirestore.getInstance()
val collectionReference = firestore.collection("/users")

collectionReference
    .orderBy("phone_number", Query.Direction.DESCENDING)
    .orderBy("g")
    .startAt("abc")
    .endAt("abc")
    .whereArrayContains("common_query_str", "AbCd")
    .limit(5).get().addOnSuccessListener {
        it.documents.forEach {
            it1 ->
                Log.d(TAG, "data1: ${it1.data}")
        }
    }

I've already built index suggested automatically in the logcat. Removing the .orderBy("phone_number", Query.Direction.DESCENDING) works but adding this to query doesn't produce any error/log in the logcat, doesn't fetch data from db either.

Here is the structure of DB:

firestore database structure

I've gone through this SO question Firestore order by two fields

0 Answers
Related