So I'm struggling to get the following query to work:
firebaseFirestore.collection("kids")
.document(documentID)
.collection("books")
.whereEqualTo("accountID", accountID)
.whereEqualTo("checkoutDate", epochDate)
.whereGreaterThanOrEqualTo("checkoutDate", firstDayThisWeekDate)
.orderBy("checkoutDate")
.orderBy("startTime", Query.Direction.ASCENDING)
.orderBy("lengthOfTime", Query.Direction.DESCENDING);
epochDate is a date object set to 01/01/1970 firstDayThisWeekDate is a date object that refers to the calendar date of the first day of this week (Sunday).
If I only have one of the two checkoutDate equalities the query works. But if I combine the two I get zero results. What am I missing?
This Works!
firebaseFirestore.collection("kids")
.document(documentID)
.collection("books")
.whereEqualTo("accountID", accountID)
.whereEqualTo("checkoutDate", epochDate)
.orderBy("checkoutDate")
.orderBy("startTime", Query.Direction.ASCENDING)
.orderBy("lengthOfTime", Query.Direction.DESCENDING);
This Works!
firebaseFirestore.collection("kids")
.document(documentID)
.collection("books")
.whereEqualTo("accountID", accountID)
.whereGreaterThanOrEqualTo("checkoutDate", firstDayThisWeekDate)
.orderBy("checkoutDate")
.orderBy("startTime", Query.Direction.ASCENDING)
.orderBy("lengthOfTime", Query.Direction.DESCENDING);
Here's the scenarios that I have for the books documents. If the field: "repeats" is true, the checkoutDate will ALWAYS be the epochDate If the field: "repeats" is false, then the dates will be something greater than the epochDate.
My goal is to be able to grab the epochDate documents and any documents that have a date that is on or after the first day of this week.
I'm trying hard to accomplish this within one query, and I think I can. I just can't reconcile having the two date comparisons. It seems like the docs say you can.
Any help would be greatly appreciated.