The documentation states:
However, if you have a filter with a range comparison (<, <=, >, >=), your first ordering must be on the same field:
That implies that I can use the non-range comparison, "==", with the orderBy clause. But this fails:
myCollectionRef.where('age', '==', 2).orderBy('name');
If you wanted to order a query with one or more equality filters, where the ordering is by a different field, you'll need to create a composite index.
You can read more about this in our "Managing Indexes" documentation section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With