// Queries
let query = geoCollection
.where("status", "==", "active")
.near({ center: new firebase.firestore.GeoPoint(latitude, longitude), radius: 1000 });
// Subscribe, add jobs into store and listen for changes
query.onSnapshot((res) => res.docs && Array.from(res.docs.map((doc) => console.log(doc.data()))));
When I perform the above it doesn't work properly. but if I do this instead it works:
let query = geoCollection.where("status", "==", "active")
or
let query = geoCollection.near({ center: new firebase.firestore.GeoPoint(latitude, longitude), radius: 1000 });
But not together! Which is what I want.
Here is the link for the Documentation. It's not very detailed, but I tried my best to look into the files and no luck so far. https://firebaseopensource.com/projects/geofirestore/geofirestore-js/
Finally found a solution. It is required that you create an Index in the Cloud Firestore console.
g.geohash
(Ascending)