Skip to content
Advertisement

Firestore: Conditional query not executed

This logs the snapshot:

JavaScript

This doesn’t:

JavaScript

Does anyone know why?

Advertisement

Answer

Since you are combining the '>=' and '==' operators, Firestore needs to build an index for this query.

If you catch the error with a try/catch block, you will see the corresponding error, and, even better, the error message includes a direct link to create the missing index in the Firebase console.

See the doc here for more details on indexing in Firestore.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement