Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geofirestore-js 3.0.0 #68

Closed
Synercio opened this issue Jan 3, 2019 · 6 comments
Closed

geofirestore-js 3.0.0 #68

Synercio opened this issue Jan 3, 2019 · 6 comments

Comments

@Synercio
Copy link

Synercio commented Jan 3, 2019

Hello team,

First of all, thanks for this great job :)

I've seen the tag 2.4.0 allow to add a custom query with the QueryCriteria but I didn't find it on the tag 3.0.0.

My goal is to limit the result from a firebase functions.

const query: GeoQuery = geoFirestore.collection("elements").near({ center: location, radius: radius, query ??? });

May you help me ?

(Sorry for my english)

@MichaelSolati
Copy link
Owner

Hey @Synercio, so this is not a problem at all. So geofirestore version 3 follows syntax much more similar to the regular firestore library. So instead you'd do this:

const query: GeoQuery = geoFirestore.collection('elements')
    .near({ center: location, radius: radius })
    .where('something', '==', 'something');

And you can keep on chaining where functions from there!

@Synercio
Copy link
Author

Synercio commented Jan 3, 2019

Oh ok thanks :)

And for the "orderBy" and "limit" it's the same behaviour ?

@MichaelSolati
Copy link
Owner

orderBy and limit aren't supported in version 2 (you could do it, but it wouldn't work) or 3. However I'm looking to add both in later versions of 3.

@Synercio
Copy link
Author

Synercio commented Jan 3, 2019

Ok, many thanks for your work @MichaelSolati :)

@24dev
Copy link

24dev commented Jan 8, 2019

@MichaelSolati OrderBy and limit would be a great addition - currently when searching through subcollections (eg. restaurant reviews), you're unable to limit or order the data. If I can help add this I'd be happy to, as it's something I'd love to add to my app.

@MichaelSolati
Copy link
Owner

MichaelSolati commented Jan 8, 2019

@alcuinguest so the problem with these additional sorts of filters for the queries stems from the fact that we aggregate multiple queries when you do a Geoquery.

It is the way geohashes work, we create an array of queries with geohashes that are around the area that you selected. So I could apply the order by or the limit to each of those queries, but when aggregated all those selections that you make will be lost. So then on the client side I have to reapply those selections. It's very much doable, it is not very much of efficient.

So it is something I'm very much looking into, but I will be taking probably a small break from this. I'm currently exploring with @thatadamedwards how we could make a sister library for Android developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants