Closed 24dev closed 5 years ago
I have not actually noticed any issue like that, are you getting an error? There is now an error listener you can use (which could be helpful, but you'll have to update to version 2.4.0
).
geoQuery.on('error', (error) => {
console.log(error.message);
});
As a side note, the example thing doesn't work and isn't necessarily intended to(?) It's something that needs to be done at some point. Anyway the only examples available are here => Viewers App Spittin Hot Geofirestore
Keep in mind they're made with version 3.0.0
in mind.
Ah yes I do get an error - Uncaught Error in onSnapshot: Error: The query requires an index. You can create it here:
Unfortunately, the link provided does not work. I assume the index is required because geofirestore is filtering the store by location, and then we're having the chained .where on top. Have you had to create an index for geofirestore before? I've made plenty of indexes but i'm not sure exactly what geofirestore is looking for when it does its filtering, so wouldn't know what to put in the index.. @MichaelSolati
Especially since the data gets stored by geo in an object d: {...},
, can you even do a deep index like that? d.approved, in my example?
The link should work, as it's produced by Firebase (not geofirestore).
But this library actually uses an indexed collection for testing (meaning yes, you can do a deep index).
So here we have the index you see below, and that works fine:
{
"indexes": [
{
"collectionId": "tests",
"fields": [
{ "fieldPath": "d.count", "mode": "ASCENDING" },
{ "fieldPath": "g", "mode": "ASCENDING" }
]
}
]
}
You could do something like that.
Currently have a functioning 'get restaurants' function, which returns all restaurants in a radius using geofirestore. Awesome. But when I add a .where() clause to the query, it stops working. The .limit() on it's own works fine - has anyone tried this yet, and have they managed to get it working?
Code here:
Error here:
Also worth pointing out the link https://geofirestore.com/examples/ is broken, so no examples!