MichaelSolati / geofirestore-js

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

Using .where() asks to be indexed, but Firebase won't allow indexing #137

Closed DustinJSilk closed 5 years ago

DustinJSilk commented 5 years ago

Hey, Great work so far and thanks for making this library!

I'm using GeoFirestore-js in a Cloud Function and I'm trying to do a simple .where. My code looks like this:

const query: GeoQuery = geoCollection.where('name', "==", "my-name").near({
    center: new admin.firestore.GeoPoint(40.7589, -73.9851),
    radius: 1000,
});

I also tried using d.name.

Firebase then gives me a link to create a new composite index, however when I try to create it, it throws Invalid empty property path string.

It says the fields are:

d.d.name Ascending
g Ascending
Arrays unspecified

Any help would be great! Thanks!

I see you're working on a V4 release. If i knew more about Firebase I'd offer some help, hopefully over the next few months I can. Any idea when you'll be releasing?

MichaelSolati commented 5 years ago

Firebase inedxing issues aren't really something I can "fix" but we can try to resolve this... Could you post a screenshot of what you see with the link firebase proviced to create the index?

DustinJSilk commented 5 years ago

Sure! This is the popup. And thats the error when I hit Create Index

Screenshot
MichaelSolati commented 5 years ago

That looks funky... So the name field should look like d.name not d.d.name, also I'm not sure why you're seeing Arrays unspecified. I'd try creating an index manually looking like this... Screen Shot 2019-08-16 at 11 34 31 AM

DustinJSilk commented 5 years ago

Thats odd, it's disabled the create button.

Screenshot 2019-08-19 at 21 57 48
DustinJSilk commented 5 years ago

I managed to get it working. I created a new collection, redeployed my functions, and now the link seems to create the index just fine. Not 100% sure what I missed there but thanks again