I am building an app with a firebase cloud firestore datadabse with the following structure:
I am doing a query of a user´s books where the field "StartDate" is greater than 0 and the "EndDate" is equal to 0, that query should then be ordered by Title.
CollectionReference booksCollection = mFirebaseDatabase.collection("users").document(user.getUid()).collection("books");
Query databaseQuery = booksCollection.whereGreaterThan("StartDate", 0).whereEqualTo("EndDate", 0).orderBy("Title");
databaseQuery.get()
To do this i read that you need to use indexing (although i did not get a link to indexing in errormessages as it stated that I should). my indexing looks like this:
but i get the errormessage:
java.lang.IllegalArgumentException: Invalid query. You have an inequality where filter (whereLessThan(), whereGreaterThan(), etc.) on field 'StartDate' and so you must also have 'StartDate' as your first orderBy() field, but your first orderBy() is currently on field 'Title' instead.