-
Notifications
You must be signed in to change notification settings - Fork 953
Closed
Labels
Description
- Firebase SDK version: 5.0.1
- Firebase Product: firestore
Firestore query on GeoPoint fields, compares the latitude but ignores longitude. Result contains all the documents with correct latitude, but all available longitude, ignoring the query input.
In the case of getting all the documents within map's bounding box, it returns with all the points vertically within the view, but horizontally, across the entire globe.
Following example should return only one location (40, -80), but it returns two including (50,-90) .
Relevant Code:
const path='locations';
const southWest=new firebase.firestore.GeoPoint( 35, -85);
const northEast=new firebase.firestore.GeoPoint( 60, -75);
Promise.all( [
firebase.firestore().collection(path).doc().set( {location: new firebase.firestore.GeoPoint( 30, -70 )}),
firebase.firestore().collection(path).doc().set( {location: new firebase.firestore.GeoPoint( 40, -80 )}),
firebase.firestore().collection(path).doc().set( {location: new firebase.firestore.GeoPoint( 50, -90 )})
])
.then(()=>{
return firebase.firestore().collection(path)
.where(`location`, '>' , southWest )
.where(`location`, '<' , northEast )
.get()
})
.then(snapshot=>{
snapshot.docs.forEach(doc=>{
console.log(JSON.stringify(doc.data()))
})
})
19th, henrylearn2rock, ollyde, IhorKlimov, nubeble and 2 more