I would like to know how to query geopoints in Firestore using Typescript. I have a collection named "locations" and documents in it with a geopoint field named "current_location". This last, has latitudes and longitudes stored in it.
I have been trying to access the field's "current_location" latitude and longitude in a query like this:
const querySnapshot = await admin.firestore()
.collection('locations')
.where('current_location.latitude' , '>=', lower_left_corner_latitude)
.where('current_location.latitude' , '<=', upper_right_corner_latitude)
.where('current_location.longitude', '>=', lower_left_corner_longitude)
.where('current_location.longitude', '<=', upper_right_corner_longitude)
.get()
However, I am getting this error:
Error: 3 INVALID_ARGUMENT: Cannot have inequality filters on multiple properties: [current_location.latitude, current_location.longitude]
How can I access those properties in the query correctly?
Thanks,