geofirex
geofirex copied to clipboard
enhancement request: Compound queries support?
It would be great if geofirex can support a chain of where's and build out the query in a way that allows the user to use https://firebase.google.com/docs/firestore/query-data/queries.
e.g. geo.collection('users').within(...).where('online', '==', true).where('state', '==', 'wa')
This is supported with a callback to the collection. But I want to add more test cases in this area because orderBy/limit a won't work exactly as expected. It's only advised to use where ==
const ref = geo.collection('users', ref => ref.where('online', '==', true).where('state', '==', 'wa'))
const query = ref.within(...)
@codediodeio right now .orderBy() doesn't work at all for me.
This returns an empty array:
const cities = this.geo.collection('cities', ref => ref.orderBy('population'))
const query = cities.within(center, radius, field)
Where not including the orderBy returns all the cities within the radius. Actually the same happens using where (checking for equality)
any update on this? Would like to use '>=', '<=' as their is a requirement in my project.
how to get actual data from query ?????
Any updates??
@khalilchoudhry Using where for more than one range filters is not allowed by firestore as mentioned here. Since the API already does a range filter on geohashes internally, this won't be possible. As @codediodeio mentioned where == should work on any query.
And for orderBy, the alternative solution is to sort the data on the application itself.
But what to do if I also have a "limit"? In this case it need to be possible to use "orderBy" :-/
I am also curious about adding a limit to the query? If there is a map search with a very large radius I am worried about getting too many results.
I am curious about the enhancement since my firestore collection document has a field created date, I am using geofirex , I need to get the recent data at a location.