MichaelSolati / geofirestore-js

Location-based querying and filtering using Firebase Firestore.
https://geofirestore.com
MIT License
505 stars 58 forks source link

How to check condition with field updateAt? #175

Closed lyseiha closed 4 years ago

lyseiha commented 4 years ago
const geoFirestoreInstance = new GeoFirestore(firestore());
const geocollection = geoFirestoreInstance
      .collection('collectionName')
      .where('isOnline', '==', 1)
      .where('updateAt', '>', new Date())
      .limit(10);
lyseiha commented 4 years ago

and i got

Error: firebase.firestore().collection().orderBy() Invalid query. Initial Query.orderBy() parameter: g has to be the same as the Query.where() fieldPath parameter(s): d.updateAt when an inequality operator is invoked 
Error: firebase.firestore().collection().orderBy() Invalid query. Initial Query.orderBy() parameter: g has to be the same as the Query.where() fieldPath parameter(s): d.updateAt when an inequality operator is invoked 
MichaelSolati commented 4 years ago

Unfortunately compound queries with inequalities (<, <=, >, >=) is impossible with Firestore (and geofirestore uses an inequality query in order to make the geoquery). See this for more details.