geofirex icon indicating copy to clipboard operation
geofirex copied to clipboard

enhancement request: Compound queries support?

Open henrylearn2rock opened this issue 7 years ago • 9 comments

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')

henrylearn2rock avatar Jul 12 '18 17:07 henrylearn2rock

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 avatar Jul 12 '18 18:07 codediodeio

@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)

eikooc avatar Aug 22 '18 14:08 eikooc

any update on this? Would like to use '>=', '<=' as their is a requirement in my project.

khalilchoudhry avatar Oct 07 '18 00:10 khalilchoudhry

how to get actual data from query ?????

maneatul avatar Oct 12 '18 13:10 maneatul

Any updates??

dmolinae avatar Jan 16 '19 18:01 dmolinae

@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.

DarshanGowda0 avatar Jan 23 '19 10:01 DarshanGowda0

But what to do if I also have a "limit"? In this case it need to be possible to use "orderBy" :-/

uklawitter avatar Jul 11 '19 16:07 uklawitter

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.

derbra1513 avatar May 17 '20 00:05 derbra1513

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.

amanjain-aj avatar Nov 29 '20 05:11 amanjain-aj