Can I request a Cloud Firestore collection with a suggestion of where equals and orderby?

The documentation states:

However, if you have a filter with range matching (<, <=,>,> =), your first order must be in the same field:

This means that I can use comparison without range, == ==, with the orderBy clause. But this fails:

myCollectionRef.where('age', '==', 2).orderBy('name');
+4
source share
1 answer

If you want to order a query with one or more equality filters, where ordering is done in another field, you need to create a composite index.

For more information, see the Index Management section .

+2
source

Source: https://habr.com/ru/post/1687761/


All Articles