0

I would like to do

 let start = new Date ('2018-08-01');
 let end = new Date ('2018-08-31');
 let ref = db.collection ('events'). where ("dt_inicio", ">", start) .where ("dt_fim", "<", end);

Error:

 Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on 'dt_inicio' and 'dt_fim'

But I get the error that is in the following link: https://cloud.google.com/appengine/docs/standard/go/datastore/query-restrictions

Is there any way I can get around the bug?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Ribak
  • 117
  • 1
  • 3

1 Answers1

1

Cloud Firestore can only do a range filter on one of the fields, not on multiple fields. The reason for this is (as usual when it comes to Firestore) that in order to reach its performance guarantees, Firestore must be able to return all results in a single stream, while only moving forward on its indexes.

I also recommend out the video series Getting started with Cloud Firestore, which covers the abilities, limits, and reasoning of Firestore.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807