I am using Firestore as my database. I wish to filter my data by using one variable and then order it chronologically using a second variable.
My code to try and achieve this is the following:
firebase.firestore().collection('supervisorRequests') .where("supervisor", "==", this.props.currentUID) .orderBy("postDate", "desc")
For the code above, I am getting the following output:
Firestore: Operation was rejected because the system is not in a state required for the operation's execution.(firestore/failed-precondition)
If I remove either
.where from the query, the problem disappears.
What is the cause of the problem? Why can't I use both "filters"? How can I obtain the data the way I requested it and avoid having to sort it manually on my end?